JMS Event

The JMS Event enables you to specify when and how frequently the process flow should be executed if any message is updated in a queue or topic of a JMS Server.

Prerequisites

Ensure that you have created JMS Provider activity.


Steps to create a JMS Event Activity

  1. Click Configure > EVENTS > JMS Event.
  2. Click CREATE JMS Event.
  3. On Create JMS Event screen, enter the name and description of the new JMS Event in the Name and Description textboxes respectively.



  4. In the JMS Provider field, select the JMS Provider activity.

  5. In the Connection Type field, select the Connection Type as either Topic or Queue.

    If you select Connection Type as Topic, you need to do the followings:

    • Add the jar, activemq-core-5.7.0, to the shared/ext folder in the PVC.
    • Restart the listener and runtime microservices by running the following command with required inputs.

      kubectl -n <namespace> rollout restart deploy <Name of the deployment>
  6. Select the Durable Subscriber checkbox if the JMS Subscriber is durable. If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a Durable Subscriber. This is applicable only when the connection type is Topic.
  7. Enter the subscriber ID in the textbox Subscriber ID.
  8. Enter the name of queue or topic as configured in the JMS Server in the Queue Or Topic Name field.
  9. Select the type of message, which you want to fetch, from the Message Type drop-down list. You can select:
    1. Text
    2. Byte
    3. Both
  10. If you want to select a specific message from the JMS Server, enter the message selector in the Message Selector field.

    The message selector is used to specify the filter criterion to receive a message that the user is interested in. The messages can be filtered based on only header references and properties references of the message. The message selector uses SQL92 query syntax to define the filter criteria. SQL92 is widely used to query the entire standard databases i.e. Oracle, SQL Server. The only difference between the database query and the message selector query is that the message selector uses, only a part of the query which is after the where clause. 

    The following message selector selects messages with a message type of car and color of blue and weight greater than 2500 pounds: 

    JMSType = 'car' AND color = 'blue' AND weight > 2500 

    The following message selector selects message with the property Sport has value either as Basketball or Football. 
    Sport in ('Basketball','Football')
  11. Follow the steps below based on whether you are using Hashicorp Vault to fetch the secrets (credentials) or you want to enter the secrets manually.

    To use Hashicorp Vault, you must enable Config Management feature and you may also need to do project mapping. For more details, refer to this page.

  12. To fetch the secrets from the Hashicorp Vault, do the followings:

    You can choose to use Hashicorp Vault for all or a specific field that need to contain secret.

    1. In the UserName field, enter the variable in the following format:
      ${Vault:<Key1>}
      Where, <Key1> is the key assigned to the username in the Hashicorp Vault. 

      Each secret is maintained as a key-value pair in Hashicorp Vault.

    2. Select the Use Vault checkbox if you want to use Vault for retrieving the password.

    3. In the Password field, enter the variable in the following format:
      ${Vault:<Key2>}
      Where, <Key2> is the key assigned to the password in the Hashicorp Vault.
  13. To enter the secrets manually, do the followings:
    1. In the UserName field, enter the username to connect to JMS Server.
    2. In the Password field, enter the password.
    3. In the Confirm Password field, re-enter the password.

  14. Select the JMS session behavior from the Session drop-down list. This drop-down list has the following options: 
      • Transactional: If you select the session behavior to be transactional, then your message will not be lost even if it was not successfully sent via the server or received at the client end. However, then you will be required to put your process flow in the JTA Begin and End block in Process Flow Designer. For this, it is mandatory to set the value of JMS Source property jtaEnlist (added in the Properties Panel of the Process Flow Designer) to true. By default, its value is false.
     
      • Non-Transactional: The default session behavior is non-transactional. In a non-transactional JMS session, your message will not be saved and therefore will not be available if in any case it has not been able to successfully sent via the server or received at the client end.
        If you select the respective JMS session to be transactional, you need to set the value of the following additional fields. Perform the following steps for the same. These fields are not available for a non-transactional JMS session.

        If you select Connection Type as Queue, and Session as Non-Transactional, you need to do the followings:

        • Add the jar, activemq-core-5.7.0, to the shared/ext folder in the PVC.
        • Restart the event microservice by running the following command with required inputs.

          kubectl -n <namespace> rollout restart deploy <Name of the deployment>
  15. Enter the date from which JMS event will start triggering; in the Event Start Date field. The date must be in mm/dd/yyyy format. Click Calendar icon and select the required date from the calendar.
  16. Enter the start time from the Time drop-down list.
  17. Enter the date on which JMS event will stop triggering, in the Event Expiry Date field. The date must be in mm/dd/yyyy format. Click the calendar icon and select the required date from the calendar.
  18. Enter the expiry time from the Time drop-down list.
  19. Enter the time interval, the JMS event checks the database Server in the Polling Frequency field. Enter the digit in the Frequency field and select the unit of time i.e. seconds, minutes or hours etc. from the Duration drop-down list.

    We recommended minimum Polling Frequency to be more than 60 seconds.


  20. Select the Enable Message Aggregator checkbox if you want to enable aggregation of the messages to be processed, and provide the following information.

    1. Number of Messages for AggregationDefine the number of messages you want to aggregate. The default value for this field is 0.

    2. Aggregation Timespan: Provide time in seconds for which the received messages will keep on aggregating. The default value for this field is 0.

      Important

      The fields Number of Messages for Aggregation and Aggregation Timespan work in coordination with each other. The messages that a consumer receives are combined into a single message and sent for processing based on the value for these fields, for example:

      1. If Aggregation Timespan is 0 and Number of Messages for Aggregation is 5: the aggregator waits for the receival of 5 messages, irrespective of the time taken to receive those messages. Once 5 messages are received, they are combined into a single message and sent it for processing.
      2. If Aggregation Timespan is 60 seconds and Number of Messages for Aggregation is 0: the consumer keeps receiving the messages until 60 seconds, and then aggregates all the messages received during the time span of 60 seconds. The aggregated messages are combined into a single message and sent for processing.
      3. If Aggregation Timespan is 60 seconds and Number of Messages for Aggregation is 5: the condition that is met first takes precedence. The message aggregation completes when the time span reaches 60 seconds or the number of received messages reach 5. The aggregated messages are combined into a single message and sent for processing.
    3. Message Types: Select the data format – JSON, XML, or PLAINTEXT – of the messages based on which you want to aggregate them.

    4. Message Joiner: Enter the delimiter based on which the messages will be aggregated. It depends on the Message Type.
      • If the Message Type is JSON: Enter an element name. This field can also be left blank.
      • If the Message Type is XML: Enter an XPath.
      • If the Message Type is PLAINTEXT: Enter a delimiter.
  21. Click Advanced Properties to expand the hierarchy. All items in Advance Properties are displayed.



  22. Type the email id in the Notification Receiver Email-ID(s) (comma separated) to receive error emails related to this JMS event.

  23. Select Trigger in Sequence check box to trigger the Event in sequential manner. If you do not select the Trigger in Sequence check box then the associated Event will trigger concurrently.

  24. If you want to enable misfire handling for your JMS event then, select the Run Once option from the Action on Misfire Event drop-down list. If you do not wish to enable misfire handling for your file event then, select the Ignore Misfire option.

    The Run Once option will run only one collective instance of all the misfires for a particular event. Whereas the Ignore Misfire option will not run a misfired event.

    The default value of Action on Misfire Event field is set to Run Once for all of the earlier events.
  25. Select the project of the activity from the drop-down list of Project.
  26. Click Save.