Java Doc for SimpleMessageListenerContainer.java in  » J2EE » spring-framework-2.0.6 » org » springframework » jms » listener » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.jms.listener 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.springframework.jms.listener.AbstractJmsListeningContainer
   org.springframework.jms.listener.AbstractMessageListenerContainer
      org.springframework.jms.listener.SimpleMessageListenerContainer

All known Subclasses:   org.springframework.jms.listener.SimpleMessageListenerContainer102,
SimpleMessageListenerContainer
public class SimpleMessageListenerContainer extends AbstractMessageListenerContainer (Code)
Message listener container that uses the plain JMS client API's MessageConsumer.setMessageListener() method to create concurrent MessageConsumers for the specified listeners.

This is the simplest form of a message listener container. It creates a fixed number of JMS Sessions to invoke the listener, not allowing for dynamic adaptation to runtime demands. Its main advantage is its low level of complexity and the minimum requirements on the JMS provider: Not even the ServerSessionPool facility is required.

See the AbstractMessageListenerContainer javadoc for details on acknowledge modes and transaction options.

For a different style of MessageListener handling, through looped MessageConsumer.receive() calls that also allow for transactional reception of messages (registering them with XA transactions), see DefaultMessageListenerContainer . For dynamic adaptation of the active number of Sessions, consider using org.springframework.jms.listener.serversession.ServerSessionMessageListenerContainer .

This class requires a JMS 1.1+ provider, because it builds on the domain-independent API. Use the SimpleMessageListenerContainer102 subclass for JMS 1.0.2 providers.
author:
   Juergen Hoeller
since:
   2.0
See Also:   javax.jms.MessageConsumer.setMessageListener
See Also:   DefaultMessageListenerContainer
See Also:   org.springframework.jms.listener.serversession.ServerSessionMessageListenerContainer
See Also:   SimpleMessageListenerContainer102





Method Summary
protected  MessageConsumercreateConsumer(Session session, Destination destination)
     Create a JMS MessageConsumer for the given Session and Destination.
protected  MessageConsumercreateListenerConsumer(Session session)
     Create a MessageConsumer for the given JMS Session, registering a MessageListener for the specified listener.
protected  voiddoInitialize()
     Creates the specified number of concurrent consumers, in the form of a JMS Session plus associated MessageConsumer.
protected  voiddoShutdown()
     Destroy the registered JMS Sessions and associated MessageConsumers.
protected  booleanisPubSubNoLocal()
     Return whether to inhibit the delivery of messages published by its own connection.
public  voidsetConcurrentConsumers(int concurrentConsumers)
     Specify the number of concurrent consumers to create.
public  voidsetPubSubNoLocal(boolean pubSubNoLocal)
     Set whether to inhibit the delivery of messages published by its own connection.
public  voidsetTaskExecutor(TaskExecutor taskExecutor)
     Set the Spring TaskExecutor to use for executing the listener once a message has been received by the provider.

Default is none, that is, to run in the JMS provider's own receive thread, blocking the provider's receive endpoint while executing the listener.

Specify a TaskExecutor for executing the listener in a different thread, rather than blocking the JMS provider, usually integrating with an existing thread pool.

final protected  booleansharedConnectionEnabled()
     Always use a shared JMS Connection.
protected  voidvalidateConfiguration()
    



Method Detail
createConsumer
protected MessageConsumer createConsumer(Session session, Destination destination) throws JMSException(Code)
Create a JMS MessageConsumer for the given Session and Destination.

This implementation uses JMS 1.1 API.
Parameters:
  session - the JMS Session to create a MessageConsumer for
Parameters:
  destination - the JMS Destination to create a MessageConsumer for the new JMS MessageConsumer
throws:
  JMSException - if thrown by JMS API methods




createListenerConsumer
protected MessageConsumer createListenerConsumer(Session session) throws JMSException(Code)
Create a MessageConsumer for the given JMS Session, registering a MessageListener for the specified listener.
Parameters:
  session - the JMS Session to work on the MessageConsumer
throws:
  JMSException - if thrown by JMS methods
See Also:   SimpleMessageListenerContainer.executeListener



doInitialize
protected void doInitialize() throws JMSException(Code)
Creates the specified number of concurrent consumers, in the form of a JMS Session plus associated MessageConsumer.
See Also:   SimpleMessageListenerContainer.createListenerConsumer



doShutdown
protected void doShutdown() throws JMSException(Code)
Destroy the registered JMS Sessions and associated MessageConsumers.



isPubSubNoLocal
protected boolean isPubSubNoLocal()(Code)
Return whether to inhibit the delivery of messages published by its own connection.



setConcurrentConsumers
public void setConcurrentConsumers(int concurrentConsumers)(Code)
Specify the number of concurrent consumers to create. Default is 1.

Raising the number of concurrent consumers is recommendable in order to scale the consumption of messages coming in from a queue. However, note that any ordering guarantees are lost once multiple consumers are registered. In general, stick with 1 consumer for low-volume queues.

Do not raise the number of concurrent consumers for a topic. This would lead to concurrent consumption of the same message, which is hardly ever desirable.




setPubSubNoLocal
public void setPubSubNoLocal(boolean pubSubNoLocal)(Code)
Set whether to inhibit the delivery of messages published by its own connection. Default is "false".
See Also:   javax.jms.TopicSession.createSubscriber(javax.jms.TopicStringboolean)



setTaskExecutor
public void setTaskExecutor(TaskExecutor taskExecutor)(Code)
Set the Spring TaskExecutor to use for executing the listener once a message has been received by the provider.

Default is none, that is, to run in the JMS provider's own receive thread, blocking the provider's receive endpoint while executing the listener.

Specify a TaskExecutor for executing the listener in a different thread, rather than blocking the JMS provider, usually integrating with an existing thread pool. This allows to keep the number of concurrent consumers low (1) while still processing messages concurrently (decoupled from receiving!).

NOTE: Specifying a TaskExecutor for listener execution affects acknowledgement semantics. Messages will then always get acknowledged before listener execution, with the underlying Session immediately reused for receiving the next message. Using this in combination with a transacted session or with client acknowledgement will lead to unspecified results!

NOTE: Concurrent listener execution via a TaskExecutor will lead to concurrent processing of messages that have been received by the same underlying Session. As a consequence, it is not recommended to use this setting with a SessionAwareMessageListener , at least not if the latter performs actual work on the given Session. A standard javax.jms.MessageListener will work fine, in general.
See Also:   SimpleMessageListenerContainer.setConcurrentConsumers
See Also:   org.springframework.core.task.SimpleAsyncTaskExecutor
See Also:   org.springframework.scheduling.commonj.WorkManagerTaskExecutor




sharedConnectionEnabled
final protected boolean sharedConnectionEnabled()(Code)
Always use a shared JMS Connection.



validateConfiguration
protected void validateConfiguration()(Code)



Methods inherited from org.springframework.jms.listener.AbstractMessageListenerContainer
protected void checkMessageListener(Object messageListener)(Code)(Java Doc)
protected void commitIfNecessary(Session session, Message message) throws JMSException(Code)(Java Doc)
protected void doExecuteListener(Session session, Message message) throws JMSException(Code)(Java Doc)
protected void doInvokeListener(SessionAwareMessageListener listener, Session session, Message message) throws JMSException(Code)(Java Doc)
protected void doInvokeListener(MessageListener listener, Message message) throws JMSException(Code)(Java Doc)
protected void executeListener(Session session, Message message)(Code)(Java Doc)
public Destination getDestination()(Code)(Java Doc)
public String getDestinationName()(Code)(Java Doc)
public String getDurableSubscriptionName()(Code)(Java Doc)
public ExceptionListener getExceptionListener()(Code)(Java Doc)
public Object getMessageListener()(Code)(Java Doc)
public String getMessageSelector()(Code)(Java Doc)
protected void handleListenerException(Throwable ex)(Code)(Java Doc)
protected void invokeExceptionListener(JMSException ex)(Code)(Java Doc)
protected void invokeListener(Session session, Message message) throws JMSException(Code)(Java Doc)
public boolean isAcceptMessagesWhileStopping()(Code)(Java Doc)
public boolean isExposeListenerSession()(Code)(Java Doc)
protected boolean isSessionLocallyTransacted(Session session)(Code)(Java Doc)
public boolean isSubscriptionDurable()(Code)(Java Doc)
protected void rollbackIfNecessary(Session session) throws JMSException(Code)(Java Doc)
protected void rollbackOnExceptionIfNecessary(Session session, Throwable ex) throws JMSException(Code)(Java Doc)
public void setAcceptMessagesWhileStopping(boolean acceptMessagesWhileStopping)(Code)(Java Doc)
public void setDestination(Destination destination)(Code)(Java Doc)
public void setDestinationName(String destinationName)(Code)(Java Doc)
public void setDurableSubscriptionName(String durableSubscriptionName)(Code)(Java Doc)
public void setExceptionListener(ExceptionListener exceptionListener)(Code)(Java Doc)
public void setExposeListenerSession(boolean exposeListenerSession)(Code)(Java Doc)
public void setMessageListener(Object messageListener)(Code)(Java Doc)
public void setMessageSelector(String messageSelector)(Code)(Java Doc)
public void setSubscriptionDurable(boolean subscriptionDurable)(Code)(Java Doc)
protected void validateConfiguration()(Code)(Java Doc)

Methods inherited from org.springframework.jms.listener.AbstractJmsListeningContainer
public void afterPropertiesSet()(Code)(Java Doc)
protected Connection createSharedConnection() throws JMSException(Code)(Java Doc)
public void destroy()(Code)(Java Doc)
abstract protected void doInitialize() throws JMSException(Code)(Java Doc)
protected void doRescheduleTask(Object task)(Code)(Java Doc)
abstract protected void doShutdown() throws JMSException(Code)(Java Doc)
protected void doStart() throws JMSException(Code)(Java Doc)
protected void doStop() throws JMSException(Code)(Java Doc)
protected void establishSharedConnection() throws JMSException(Code)(Java Doc)
final protected String getBeanName()(Code)(Java Doc)
public String getClientId()(Code)(Java Doc)
final protected Connection getSharedConnection()(Code)(Java Doc)
public void initialize() throws JmsException(Code)(Java Doc)
final public boolean isActive()(Code)(Java Doc)
final public boolean isRunning()(Code)(Java Doc)
protected void prepareSharedConnection(Connection connection) throws JMSException(Code)(Java Doc)
final protected void refreshSharedConnection() throws JMSException(Code)(Java Doc)
final protected boolean rescheduleTaskIfNecessary(Object task)(Code)(Java Doc)
public void setAutoStartup(boolean autoStartup)(Code)(Java Doc)
public void setBeanName(String beanName)(Code)(Java Doc)
public void setClientId(String clientId)(Code)(Java Doc)
abstract protected boolean sharedConnectionEnabled()(Code)(Java Doc)
public void shutdown() throws JmsException(Code)(Java Doc)
public void start() throws JmsException(Code)(Java Doc)
protected void startSharedConnection() throws JMSException(Code)(Java Doc)
public void stop() throws JmsException(Code)(Java Doc)
protected void stopSharedConnection() throws JMSException(Code)(Java Doc)
protected void validateConfiguration()(Code)(Java Doc)
final protected void waitWhileNotRunning()(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.