Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
  /*
   * Creates a JMS connection with the default user identity. The connection is 
   * created in stopped mode. No messages will be delivered until the 
   * Connection.start method is explicitly called.
   * 
   * @return a newly created JMS connection. May return null
   * 
   */
   public Connection createConnection();
	
  /*
   * Creates a JMS connection with the specified user identity. The connection is 
   * created in stopped mode. No messages will be delivered until the 
   * Connection.start method is explicitly called.
   * 
   * @parameter userName - the caller's user name
   * @parameter password - the caller's password
   * 
   * @return a newly created JMS connection. May return null
   */
   public Connection createConnection(String userName, String password);
	
  /*
   * Gets the JMS Connection with the specified user identity, configured in components.xml
   * The connection is returned in start mode.
   * 
   * @return the initially created JMS Connection object. May return null
   * 
   */
   public Connection getConnection();

Usage with Spring

No Format

  <!-- definition of a message producer -->
  <bean id="org.sakaiproject.messageservice.test.MessageProducer"
    class="org.sakaiproject.messageservice.test.MessageProducerImpl">
      <property name="connectionFactory"
        ref="org.sakaiproject.messageservice.JmsConnectionFactory" />
      <property name="queueName" value="test.destination" />
  </bean>

  <!-- definition of listner container -->
  <bean id="listenerContainer"
    class="org.springframework.jms.listener.DefaultMessageListenerContainer"
    depends-on="org.sakaiproject.messageservice.JmsConnectionFactory">
      <property name="concurrentConsumers" value="1" />
      <property name="maxConcurrentConsumers" value="1" />
      <property name="connectionFactory"
        ref="org.sakaiproject.messageservice.JmsConnectionFactory" />
      <property name="destinationName" value="test.destination" />
      <!-- set pubSubDomain to false to create a queue instead of a Publish/Subscribe topic -->
      <property name="pubSubDomain" value="true"/>
      <property name="messageListener">
	<bean class="org.sakaiproject.messageservice.test.MessageListenerImpl"/>
      </property>
  </bean>

MessageService (JMS) Best Practices

...