- Points to Note
- Configuration and Testing
- Functional Demonstration
- Useful Tips
The JMSOut component may be used to retrieve messages from a JMS Topic/Queue. Using the Configuration Property Sheet, you can specify the topic or queue from which the message is to be retrieved. The JMSOut component sends the JMS message received from a Topic/Queue to another component. You can create a Subscriber or a Receiver for a Topic or a Queue respectively, and configure the component to retrieve or subscribe to messages from a JMS server at runtime.
This component can be used to receive Text, Bytes or Map messages. The only restriction on Map Messages is that this component does not support Objects in Map Messages.
JMSOut is capable of handling following types of messages:
- Text messages: A TextMessage object's message body contains a java.lang.String object.
- Map messages: A MapMessage object's message body contains a set of name-value pairs, where names are String objects, and values are Java primitives. The entries can be accessed sequentially or randomly by name. The order of the entries is undefined.
- Bytes Message: A BytesMessage object's message body contains a stream of uninterrupted bytes. This message type is for literally encoding a body to match an existing message format.
Points to Note
- The only restriction on Map Messages is that this component does not support Objects in Map Messages.
- When adding the Initial Context Factory class for non Fiorano MQ server, the jar file(s) should be added as resource(s) to the JMSAdapters system library.
- For creating Durable Subscriber, use Topic Connection Factory in place of Unified Connection Factory.
- If IsDurableSubscriber property is changed to No or Destination Type is changed from Topic to Queue or ClientID is changed - the durable subscriptions created earlier should be unsubscribed to avoid persisting messages for the durable subscriber in runtimedata. For more information on unsubscribing, please refer to the Durable Subscribers section in the FioranoMQ Handbook - Connecting to Web Management Tool section.
- If a timeout is not specified (left as zero – infinite), and after starting the component, the JMS server (to which the component is connected) crashes, the receive call on the Queue or Topic waits endlessly. Therefore, it is advisable to give a definite timeout value.
- If the component is being used in scheduling mode, the execution timeout for the component should be less than the scheduler interval if the message is being received from a Queue.
- The property 'Cleanup resources (excluding connection) after each document' is set to 'No' by default. If this is set to 'Yes', then only one message is received by JMSOut and after that resources like message consumers are closed and the component will not receive further messages.
Configuration and Testing
The JMSOut component connection related properties can be configured in the Managed Connection Factory panel of CPS.
Managed Connection Factory
Figure 1: Sample JMSOut MCF configuration
Provide URL Settings
Use Connection Details From Input
Parameters to create the connection can be specified in the input message when this property is set to true. If this property is selected the validation errors in the managed connection factory panel of the CPS are treated as warnings. So the user can bypass this step without giving valid configuration and complete the configuration of the component. If valid properties are not provided even in the input message exception will be thrown at runtime.
The JMS providers supported are Fiorano MQ, BEA Weblogic, Oracle AQ, Oracle Streams AQ and JBoss. For working with these JMS providers the jars that should be explicitly added as resources to the component are given below:
- %BEA_HOME%\server\lib\wljmsclient.jar (required only when the Weblogic server is running on a remote machine)
%BEA_HOME%\server\lib\wlthint3client.jar (required only when the Weblogic server is running on a remote machine)
- %ORACLE_HOME%\rdbms\jlib\aqapi13.jar (If JDK1.2 / JDK1.1 is used, aqapi12.jar/aqapi11.jar has to be used respectively)
Oracle Streams AQ
Along with the JBoss jars mentioned above, add the below jars as well:
Working with Fiorano MQ HA profiles
When Configuring JMSOut with Fiorano MQ HA profiles, you should provide Initial Context Properties in Advanced Info in the Managed Connection Factory Panel of the CPS.
These Properties are:
- "java.naming.provider.url" set to Server URL
- "BackupConnectURLs" set to backupURLs
Secured Connections to Fiorano MQ (SSL)
If Fiorano MQ server uses SSL, then provide the following properties in Advanced Info Under Initial Context Properties.
- java.naming.security.protocol: Name of the security protocol used to create secure connections with the MQ server.
- Valid value: The possible values that this variable can take are PHAOS_SSL and SUN_SSL.
SecurityManager(optional): The Security Manager implementation used to create secure connections [HTTPS or SSL] with the MQ server. The manager class should be an implementation of the fiorano.jms.runtime.IFMQSecurityManager interface provided by FioranoMQ.
- Valid value: Qualified class name of security Manager class.
Figure 3: Interaction Configurations
Figure 4: Destination Configurations
Name of the topic or queue to which messages are to be transferred.
The JMS type of the destination; either Topic or Queue.
Select one of these destination types:
- Topic: Message can be consumed by a number of clients. Topic represents Public Subscription (Pub/Sub) domain.
- Queue: Message can be consumed by only one client. Queue represents Point to Point (PTP) domain.
This option can be chosen if the destination is already present and needs to be looked up using JNDI.
If destination provided is not present, then it is created dynamically.
Refer the section in JMSIn4.0 page for the descriptions of remaining attributes present in Destination Configuration property.
Click the Ellipsis button to set the Consumer Configuration.
This property is used to create a durable subscription when the destination type is Topic.
Figure 5: Option to configure Consumer Configuration in the dialog box
Subscription Name: Provide a unique Subscription Name for durable subscriber.
Message Selector: The JmsOut 4.0 filters those Messages from the configured Destination which satisfies the given condition in the Message Selector. In the above figure,all the messages with propertyName = "property" and PropertyValue = "value" are filtered by the JmsOut.
Message Type Settings
Byte Message as Text
Use this option when the destination is "AMQP" Destination in case of RabbitMQ JMS Provider.
Figure 6: Byte Message as Text option in the Message Type configuration palette
For the attributes given below (all except the last one are Expert Properties), please refer Interaction Configurations section in Common Configurations page.
- Pre Processing XSL Configuration
- Post Processing XSL Configuration
- Validate Input
- Cleanup Resources (excluding connection) after each input document
- Target Namespace
- Monitoring Configuration
Refer to the Processing Message based on a Property section for the description of the property.
The properties that are unique for JMSOut component are mentioned below.
Action when message is not available?
Figure 7: Option to configure when message is not available
This property specifies the action to be taken when there are no messages on the queue within the timeout specified.
- Send Empty Message
An empty message is sent to the output port.
- Treat as Exception
An exception message is sent to error port and no message is sent to the output port.
- No Action
No message is sent to either output port or error port.
Remove Properties with null value
If this option is checked, header properties with a null value will be excluded in the Output message retrieved from JMS server.
Maximum time in milliseconds the component should wait for a message. The default value is 0 which specifies infinite wait time that is, waits until a message is received.
Testing the Connection
Server connection can be tested from within the CPS by clicking on test in the Managed Connection Factory panel.
Figure 8: Sample connection test result indicating success
Sample JMSOut configuration
The JMSOut component can be configured using its Custom Proper Sheet wizard.
Destination specified for the property Destination Name should already exist if BEA Weblogic/Oracle AQ/Oracle Streams AQ is being used. Dynamic creation of destinations is not supported for these providers.
For BEA Weblogic, value for Destination Name should be the JNDI name of the destination.
Below configuration can be tested from within the CPS by clicking on test button in the CPS panel:
Destination Name - PrimaryQueue
Destination Type - Queue
AutoCreate destination - Enabled
Figure 9: Sample JMSOut input message
Figure 10: Sample JMSOut output message
When the Use Connection details from input property is chosen, the following input schema with the element 'ConnectionFactorySettings', is generated. Properties that are used to create the connection are present under this element.
Figure 11: Input schema with ConnectionFactorySettings
Putting a simple Text message on a destination and displaying the response message.
Configure the JMSOut as described in Configuration and Testing section and use feeder and display component to send sample input and check the response respectively.
Figure 12: Demonstrating Scenario 1 with sample input and output
Raw Text Message, that is, "Input Text"
- Choose non-durable messages where appropriate
- When using the durable delivery mode, each message has to be stored by the JMS server either in the database or the file system depending on the vendor before delivery of the message to the consumer and removed after delivery of the message. This has a huge impact on the performance. So as far as possible restrict the use of durable delivery mode unless and until absolutely necessary for your application to avoid the overheads involved.
- Choose proper acknowledgment mode