Inbound Implementation - JMS
Inbound Implementation - JMS
Inbound implementations take the form of modifying the UAC.xml
file with a definition. The container will read this file to construct the connection to the target defined by the value of the Property java.naming.provider.
The following figure illustrates an example of this construction.
<sb:Property> <sb:Name>java.naming.provider.url</sb:Name> <sb:Value>tcp://soatest2:61616</sb:Value> </sb:Property>
In the following examples:
- Messages consumed from the topic or queue are written to the file system defined by the <sb:Directory> tag.
- <sb:Filename> tag denotes the filename that is be written to the filesystem.
- %Seq% defines an increment so that subsequent messages consumed from the topic do not collide with already existing filenames.
ActiveMQ Topic
The following figure illustrates an attachment to an Apache ActiveMQ dynamic topic.
<sb:JMSConnection> <sb:Name>JMS ActiveMQ Topic Listener - soatest2/</sb:Name> <sb:InitialContextProperties> <sb:Property> <sb:Name>java.naming.factory.initial</sb:Name> <sb:Value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</sb:Value> </sb:Property> <sb:Property> <sb:Name>java.naming.provider.url</sb:Name> <sb:Value>tcp://soatest2:61616</sb:Value> </sb:Property> </sb:InitialContextProperties> <sb:ConnectionFactory>ConnectionFactory</sb:ConnectionFactory> <sb:Listeners> <sb:JMSListener> <sb:Destination>dynamicTopics/UemsoaStartTopicA</sb:Destination> <sb:Actions> <sb:JMSFileWriter> <sb:Directory>filesystem</sb:Directory> <sb:FilenamePattern>ActiveMQ_Topic_%Seq%.txt</sb:FilenamePattern> <sb:StartSequenceNumber>1</sb:StartSequenceNumber> <sb:WriteProperties>false</sb:WriteProperties> </sb:JMSFileWriter> </sb:Actions> </sb:JMSListener> </sb:Listeners> </sb:JMSConnection> </pre>
Websphere Queue
The following figure illustrates an attachment to an IBM Websphere queue.
<sb:JMSConnection> <sb:Name>JMS WebSphere Queue Listener - soatest2</sb:Name> <sb:InitialContextProperties> <sb:Property> <sb:Name>java.naming.factory.initial</sb:Name> <sb:Value>com.ibm.websphere.naming.WsnInitialContextFactory</sb:Value> </sb:Property> <sb:Property> <sb:Name>java.naming.provider.url</sb:Name> <sb:Value>iiop://soatest2:2809</sb:Value> </sb:Property> <sb:Property> <sb:Name>com.ibm.CORBA.ORBInit</sb:Name> <sb:Value>com.ibm.ws.sib.client.ORB</sb:Value> </sb:Property> </sb:InitialContextProperties> <sb:ConnectionFactory>jms/SBSConnectionFactory</sb:ConnectionFactory> <sb:Listeners> <sb:JMSListener> <sb:Destination>jms/Soatest2TestQueue3</sb:Destination> <sb:Actions> <sb:JMSFileWriter> <sb:Directory>filesystem<sb:Directory> <sb:FilenamePattern>Websphere_Queue_%Seq%.txt</sb:FilenamePattern> <sb:StartSequenceNumber>1</sb:StartSequenceNumber> <sb:WriteProperties>false</sb:WriteProperties> </sb:JMSFileWriter> </sb:Actions> </sb:JMSListener> </sb:Listeners> </sb:JMSConnection>
MQ Series Queue
The following figure illustrates an attachment to an IBM MQ Series Queue.
<sb:MQConnection> <sb:Name>MQ Series Listener - soatest2</sb:Name> <sb:Host>soatest2</sb:Host> <sb:QueueManagerName>MyQueueManager</sb:QueueManagerName> <sb:Channel>UpsQaChannel</sb:Channel> <sb:Port>1414</sb:Port> <sb:Listeners> <sb:MQListener> <sb:QueueName>UpsQaQueue</sb:QueueName> <sb:Actions> <sb:MQFileWriter> <sb:Directory>filesystem</sb:Directory> <sb:FilenamePattern>MQSeries_Queue_%Seq%.txt</sb:FilenamePattern> <sb:StartSequenceNumber>0</sb:StartSequenceNumber> <sb:WriteProperties>false</sb:WriteProperties> </sb:MQFileWriter> </sb:Actions> </sb:MQListener> </sb:Listeners> </sb:MQConnection>
Triggering an Event
Once a file has been written to the file system, UEM could be used to trigger an event, as shown in the following figure.
This event, which would be loaded by UEMLoad, looks for files with an extension of txt. When it sees a file with that extension, UEM renames the file to the original name with an xml extension. It then executes the handler, which runs a system command to move the file.
The UDM script looks for all files that begin with a 2 and end with .xml on the local server. These file are then transferred to the destination server, overwriting any existing files on the destination server, and the session is closed.
begin_event event_id "JMS_MESSAGE_TRIGGER" event_type FILE comp_name uems state enable tracking_int 10 triggered_id "JMS_MESSAGE_HANDLER" filespec "filesystem/*.txt" min_file_size 0 rename_file yes rename_filespec "filesystem/$(origname).xml" end_event begin_handler handler_id "JMS_MESSAGE_HANDLER" handler_type CMD maxrc 0 userid username pwd user_password cmd "udm -s udm.script" end_handler
Event Options
The Event options used in this example are:
Option | Description |
---|---|
event_id | Identifier that uniquely identifies an event definition record. |
event_type | Type of system event represented by the event definition record. |
comp_name | Event-driven UEM Server responsible for monitoring the event. |
state | Event definitions that should be processed or ignored by UEM. |
Event definitions that should be processed or ignored by UEM. | |
ID of an event handler record that UEM will execute when an event occurrence is triggered. | |
Name of a file to monitor. | |
Size a file must be in order to be considered complete by UEM. | |
Specifies whether or not UEM should rename a monitored file when an event occurrence is triggered. | |
Specifies how a file should be renamed when an event occurrence is triggered. | |
Identifier that uniquely identifies an event handler record. | |
Type of process executed for the event handler. | |
Highest value with which a handler can exit to still be considered as having executed successfully. | |
ID of a user account in whose security context the handler process will be executed. | |
Password for the user account specified by userid. | |
Command to execute on behalf of the event handler. |