- Points to note
- Configuration and Testing
- Managed Connection Factory
- Interaction Configurations
- Scheduler Configurations
- Testing the Connection
- Functional Demonstration
- Useful Tips
The JMSIn component is used to transfer messages to a JMS topic or queue. Using the Configuration Property Sheet wizard, you can specify the topic or queue on which the message is to be sent. This component retrieves messages from a component and sends them to a JMS topic or queue. Additionally, you can create a Publisher or a Sender on Topic or Queue respectively, and configure the component to publish or send a message on a JMS Server at runtime.
This component can be used to send Text, Bytes or Map messages. The only restriction on Map Messages is that this component does not support Objects in Map Messages.JMSIn 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.
Configuration and Testing
The JMSIn component connection related properties can be configured in the Managed Connection Factory panel of CPS.
Managed Connection Factory
Figure 1: Sample JMSIn MCF configuration
Provider 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 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 BEA Weblogic, Fiorano MQ, Oracle AQ, Oracle Streams AQ, JBoss, Open MQ, and Rabbit MQ.
Figure 2: List of JMS Providers
For working with these JMS providers, the jars that should be explicitly added as resources to the microservice are as 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:
Figure 3: Connection Configuration
Password Encryption Configuration
Please refer Custom Encryption For Passwords section in Common Configurations page for the documentation.
The URL of the server to which the microservice connects.
The backup URLs to which the component tries to connect if the server specified by the property "server URL" is down. Multiple backup URLs can be specified by separating them with a ';'.
CF lookup name
Connection Factory Lookup Name.
Username with which the connection to the server is established.
Password for the username mentioned.
Please refer to Proxy Settings section in Common Configurations page for the documentation.
Connection Pool Params
Please refer to Connection Pool Params section in Common Configurations page for the documentation.
Click the Ellipsis button to configure the SSL Settings in the dialog box.
Figure 4: SSL Security settings options in the SSL Configuration panel
|Enable SSl||Select this option to enable SSL Settings. Rest of the properties in this editor are enabled and configurable only when this property is checked.|
|Trust Store Location||Location of the Java keystore file containing the collection of CA certificates trusted by this application process (trust store)|
|Trust Store Password||Password to unlock the keystore file (store password)|
|Key Store Location||Location of the Java keystore file containing an application process's own certificate and private key.|
|Key Store Password||Password to access the private key from the keystore file.|
|Key Store Type||For Java keystore file format, this property has the value jks(or JKS). You do not normally specify this property, because its default value is already jks.|
|Trust Store Type||For Java keystore file format, this property has the value jks(or JKS). You do not normally specify this property, because its default value is already jks|
|Trust Manager Factory Type||Algorithm for the Trust Manager Factory.|
|Key Manager Factory Type||Algorithm for the Key Manager Factory.|
|Security Provider Class||Determines Security provider class.|
|Security Protocol||Determines Security protocol|
|Key Store Client Key||Determines Key Store Client Key|
Figure 5: JNDI Settings
Click the Ellipsis button to configure the JNDI settings in the dialog box.
Initial Context Factory
The name of the initial context factory. The initial context is typically used as a starting point.
The name with which the user connects to the JNDI server to perform lookup operations.
CF lookup name
The lookup name of the Connection Factory
The password for the JNDI username.
Initial Context Properties
Initial Context Properties can be used for creating an initial context by providing specific values by clicking Add button.
An initial context must be created using the specific implementation and extra parameters required by the implementation. The initial context will be used to look up a name. It is analogous to the root or top of a directory tree for a file system.
Working with Fiorano MQ HA profiles
While configuring JMSIn with Fiorano MQ HA profiles, provide Initial Context Properties in Advanced Info in the Managed Connection Factory Panel in the CPS.
Set the properties as below:
- Server URL: java.naming.provider.url
- Backup URLs: BackupConnectURLs
Secured Connections to Fiorano MQ (SSL)
If Fiorano MQ server uses SSL then, provide the following properties in Advanced Info Under Initial Context Properties.
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.
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.
Client Identifier for the connection. This value is also used while creating the subscription name for a Durable Subscriber.
In case of Oracle AQ, this value will be used only as the Subscription Name but not as a Client Identifier for the connection
Event Process name or Service Instance name is will be set as Client Identifier for the connection.
Client ID is not specifically set on connection, that is, connection.setClientID() is not called.
The type of Acknowledgement mode can be specified here. A session retains messages it consumes until they have been acknowledged.
The session automatically acknowledges a client's receipt of a message either when the session has successfully returned from a call to receive or when the message listener the session has called to process the message successfully returns.
With this acknowledgment mode, the client acknowledges a consumed message.
Dups OK Acknowledge
This acknowledgment mode instructs the session to lazily acknowledge the delivery of messages.
Figure 6: Interaction Configurations panel in CPS
Figure 7: Destination Configuration options
Name of the topic/queue to be subscribed to.
The JMS type of the destination; either Topic or Queue.
Select one of these destination types:
- Topic: Message can 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.
Whether destination needs to be created, if it does not exists.
Figure 8: Producer Configuration options
Instructs the JMS provider to take extra care to ensure that a message is not lost in transit in case of a JMS provider failure. A message sent with this delivery mode is logged to stable storage when it is sent.
NON_PERSISTENT delivery mode does not require the JMS provider to store the message or otherwise guarantee that it is not lost if the provider fails.
Time to Live
The time to live (in milliseconds) of the message to be sent to the destination. After the timeout the message will be discarded.
The priority of the message to be sent to the destination.
Retain Application Context
To retain Application Context.
Refer Monitoring Configuration section in Common Configurations page.
Message Type configuration
Figure 9: Message Type Configuration options
- Map Message
A MapMessage object is used to send a set of name-value pairs. The names are String objects, and the values are primitive data types in the Java programming language. The names must have a value that is not null, and not an empty string. The entries can be accessed sequentially or randomly by name. The order of the entries is undefined. MapMessage inherits from the Message interface and adds a message body that contains a Map.
- Byte Message as Base64 encoded Text
Base64 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remains intact without modification during transport. Base64 is commonly used in a number of applications including email via MIME, and storing complex data in XML.
- Text Message
Text message in any of the following formats:
- Raw Text
- Plain Text
- XML Text: Selecting this option gives more options to provide a specific XSD Schema.
Figure 10: Text Message option in Message Type Configuration dialog box
Please refer section in Common Configurations page.
Testing the Connection
Server connection can be tested from within the CPS by clicking on Test in the Managed Connection Factory panel.
Figure 11: Sample connection test result indicating success
Sample JMSIn configuration
The JMSIn 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.
In case of Oracle AQ, to grant user necessary privileges and to create a sample Topic(MY_TOPIC1)/Queue(MY_QUEUE1), execute following queries in Oracle DB configured in CPS:
- To Grant Permissions:
- CONNECT SYSTEM
- grant create session to [USER]
- grant connect, resource, aq_administrator_role to [USER] identified by [USER];
- grant execute on sys.dbms_aqadm to [USER];
- grant execute on sys.dbms_aq to [USER];
- To Create Queue:
- CONNECT [USER]
- EXEC dbms_aqadm.create_queue_table (queue_table=>'MY_QUEUE1', queue_payload_type=>'sys.aq$_jms_text_message', multiple_consumers=>false );
- EXEC dbms_aqadm.create_queue(queue_name=>'MY_QUEUE1', queue_table=>'MY_QUEUE1');
- EXEC dbms_aqadm.start_queue(queue_name=>'MY_QUEUE1');
- To Create Topic:
- CONNECT [USER]
- EXEC dbms_aqadm.create_queue_table(queue_table=>'MY_TOPIC1', queue_payload_type=>'sys.aq$_jms_text_message', multiple_consumers=>true);
- EXEC dbms_aqadm.create_queue(queue_name=>'MY_TOPIC1', queue_table=>'MY_TOPIC1');
- EXEC dbms_aqadm.start_queue(queue_name=>'MY_TOPIC1');
Below configuration can be tested from within the CPS by clicking the Test button in the CPS panel.
Destination name - Primary Topic
Destination Type - Topic
Auto Create Destination - Enabled
Priority of message - 4
Time to Live - 0
Delivery Mode - Non-persistent
Figure 12: Sample JMSIn input message
Figure 13: Sample JMSIn output message
When the property Use Connection details from input 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 14: Input schema with ConnectionFactorySettings
Body of the response message
Message sent to the destination
Putting a simple Text message on a destination and displaying the response message.
Configure the JMSIn as described in Configuration and Testing section and use feeder and display component to send sample input and check the response respectively.
Figure 15: Demonstrating Scenario 1 with sample input and output
- Set optimal message age (Time-to-live property) so as to reduce memory overhead, thus improving performance.
- Less message size gives better performance and vice versa. For example, ByteMessage takes less memory than TextMessage, hence choose message type carefully to avoid unnecessary memory overhead.
- Delivery mode defines whether the message can be persistent or non-persistent; this factor has an impact on the performance. Choose non-persistent messages where appropriate.