com.ibm.websphere.webmsg.publisher.jndijms
Class JmsPublisher

java.lang.Object
  extended by com.ibm.websphere.webmsg.publisher.jndijms.JmsPublisher
All Implemented Interfaces:
Publisher

public class JmsPublisher
extends java.lang.Object
implements Publisher

Publisher implementation that uses a JMS ConnectionFactory to propagate messages. The ConnectionFactory is configured as a JNDI administered object, the key to which is passed in as a context parameter. JNDI lookup occurs during initialization. For every publish operation, a connection, session and producer is created and closed. (JCA Connection pooling should alleviate some of the weight of those operations). This should push some of the connection management issues back to the JCA container and remove some any threading concerns when using this class. Long property PROPERTY_MAX_CONNECT_TIME, if > 0, will indicate the publish request should be retried accord to duration set by Long property CONNECT_DELAY_INTERVAL (duration multiplied by Integer value specified by property PROPERTY_CONN_DELAY_MULTIPLIER). This could help in a clustered environment when an ME fails over.


Field Summary
static java.lang.String EVENT_HEADER_ATTRIBUTE_NAME_JMS_DELIVERY_MODE
           
static java.lang.String EVENT_HEADER_ATTRIBUTE_NAME_JMS_PRIORITY
           
static java.lang.String EVENT_HEADER_ATTRIBUTE_NAME_JMS_TIME_TO_LIVE
           
static java.lang.String PROPERTY_CONN_DELAY_MULTIPLIER
           
static java.lang.String PROPERTY_CONN_DELAYINTERVAL
           
static java.lang.String PROPERTY_KEY_CONNECTION_FACTORY_JNDI_NAME
           
static java.lang.String PROPERTY_KEY_DEFAULT_DESTINATION
           
static java.lang.String PROPERTY_KEY_INITIAL_CONTEXT_FACTORY
           
static java.lang.String PROPERTY_KEY_JMS_CLIENT_ID
           
static java.lang.String PROPERTY_KEY_PROVIDER_URL
           
static java.lang.String PROPERTY_MAX_CONNECT_TIME
           
 
Constructor Summary
JmsPublisher()
          Constructor
 
Method Summary
 void close()
          Close publisher, includes shutting down any connections, etc.
 void initialize(PublisherContext context)
          Context attribute CONNECTION_FACTORY_JNDI_NAME is mandatory and it contains the String key with which to look up the ConnectionFactory from JMS.
 void publish(WebMessage message)
          Publish given WebMessage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_KEY_CONNECTION_FACTORY_JNDI_NAME

public static final java.lang.String PROPERTY_KEY_CONNECTION_FACTORY_JNDI_NAME
See Also:
Constant Field Values

PROPERTY_KEY_INITIAL_CONTEXT_FACTORY

public static final java.lang.String PROPERTY_KEY_INITIAL_CONTEXT_FACTORY
See Also:
Constant Field Values

PROPERTY_KEY_PROVIDER_URL

public static final java.lang.String PROPERTY_KEY_PROVIDER_URL
See Also:
Constant Field Values

PROPERTY_KEY_JMS_CLIENT_ID

public static final java.lang.String PROPERTY_KEY_JMS_CLIENT_ID
See Also:
Constant Field Values

PROPERTY_KEY_DEFAULT_DESTINATION

public static final java.lang.String PROPERTY_KEY_DEFAULT_DESTINATION
See Also:
Constant Field Values

EVENT_HEADER_ATTRIBUTE_NAME_JMS_DELIVERY_MODE

public static final java.lang.String EVENT_HEADER_ATTRIBUTE_NAME_JMS_DELIVERY_MODE
See Also:
Constant Field Values

EVENT_HEADER_ATTRIBUTE_NAME_JMS_PRIORITY

public static final java.lang.String EVENT_HEADER_ATTRIBUTE_NAME_JMS_PRIORITY
See Also:
Constant Field Values

EVENT_HEADER_ATTRIBUTE_NAME_JMS_TIME_TO_LIVE

public static final java.lang.String EVENT_HEADER_ATTRIBUTE_NAME_JMS_TIME_TO_LIVE
See Also:
Constant Field Values

PROPERTY_MAX_CONNECT_TIME

public static final java.lang.String PROPERTY_MAX_CONNECT_TIME
See Also:
Constant Field Values

PROPERTY_CONN_DELAYINTERVAL

public static final java.lang.String PROPERTY_CONN_DELAYINTERVAL
See Also:
Constant Field Values

PROPERTY_CONN_DELAY_MULTIPLIER

public static final java.lang.String PROPERTY_CONN_DELAY_MULTIPLIER
See Also:
Constant Field Values
Constructor Detail

JmsPublisher

public JmsPublisher()
Constructor

Method Detail

initialize

public void initialize(PublisherContext context)
                throws PublisherException
Context attribute CONNECTION_FACTORY_JNDI_NAME is mandatory and it contains the String key with which to look up the ConnectionFactory from JMS. Context attribute JMS_CLIENT_ID is optional and allows the specification of a particular JMS client ID for the connection. Optional JNDI InitialContext attributes are INITIAL_CONTEXT_FACTORY and PROVIDER_URL for additional JNDI configuration should it be required.

Specified by:
initialize in interface Publisher
Parameters:
context - - Context in which the publisher is running.
Throws:
PublisherException - - if there is initialization error.
See Also:
Publisher.initialize(com.ibm.websphere.webmsg.publisher.PublisherContext)

close

public void close()
           throws PublisherException
Description copied from interface: Publisher
Close publisher, includes shutting down any connections, etc.

Specified by:
close in interface Publisher
Throws:
PublisherException - If error closing publisher.
See Also:
Publisher.close()

publish

public void publish(WebMessage message)
             throws PublisherException
Publish given WebMessage. DeliveryMode, Priority, and time to live values come messages being published if set, if not defaults are used.

Specified by:
publish in interface Publisher
Parameters:
message - Message to be published.
Throws:
PublisherException - If there is any error with publishing the exception.
See Also:
Publisher.publish(WebMessage)