Before you Begin

This tutorial shows you how to configure Downstream Message Push usinf JMS and SOAP on the TomEE server.

Overview

Downstream Message Push (DMP) adds ability to push messages downstream on completion of an activity before data is committed to Database. The functionality will be enabled by the configuration provided in business rule. This tutorial covers the DMP configuration on the TomEE server through JMS and SOAP.

Scenario

In this tutorial we are using the Prototype company and its default configuration for setting the DownstreamMessagePush feature for the V11.3.1.0 version on the TomEE server.

Pre-requisite

  1. Verify which version of TomEE server is installed.
  2. The PAS.property should be setup to define the environment to be used to send messages.
  3. Verify if the Rules Palette version is 11.3.1.x.
  4. Verify if Acoutboundevent table is created in Admin Console database. How to Setup Admin Console on TomEE

Step 1: Set Up

Modify the PAS.property file

In the PAS.properties file add the below property:

#-----------------------------------------------------------------------
# Development mode is pointed to Development environment
# Production mode is pointed to Production environment
# Test mode is pointed to Test environment
#-----------------------------------------------------------------------
downstream.service.event.mode=Development
#-----------------------------------------------------------------------
# Required for viewing JMX events published on Admin Console. For DMP, outboundEventPush entity needs to be added
#-----------------------------------------------------------------------
jmx.notification.entities=cycle,login,activity,activityprofiling,outboundEventPush

Step 2: Configure TomEE

Configuring Connection Factory and Message Queue in the tomee.xml file. The following example describes the configuration of DownstreamMessagePush if the server is running locally.

TomEE 8.0.x (Java 8 and Java 11)

<Resource id="JMSResourceAdapter" type="ActiveMQResourceAdapter">
BrokerXmlConfig = broker:(tcp://hostname:port)
ServerUrl = tcp://hostname:port
DataSource = ADMINSERVERDS
</Resource>

<Resource id="DownstreamMessagePushConnectionFactory" type="javax.jms.ConnectionFactory">
resourceAdapter = JMSResourceAdapter
</Resource>

<Container id="JmsMdbContainer" ctype="MESSAGE">
ResourceAdapter = JMSResourceAdapter
</Container>

<Resource id="DownstreamMessagePushQueue" type="javax.jms.Queue"/>

TomEE 9.x (Java 17)

<Resource id="JMSResourceAdapter" type="ActiveMQResourceAdapter">
BrokerXmlConfig = broker:(tcp://hostname:port)
ServerUrl = tcp://hostname:port
DataSource = ADMINSERVERDS
</Resource>

<Resource id="DownstreamMessagePushConnectionFactory" type="jakarta.jms.ConnectionFactory">
resourceAdapter = JMSResourceAdapter
</Resource>

<Container id="JmsMdbContainer" ctype="MESSAGE">
ResourceAdapter = JMSResourceAdapter
</Container>

<Resource id="DownstreamMessagePushQueue" type="jakarta.jms.Queue"/>

Step 3 Configure DownstreamMessagePushDefinition using JMS and SOAP

DownstreamMessagePushDefinition defines message delivery using JMS protocol. Refer to the XML Configuration guide for more details on the DownstreamMessagePush Elements and Attributes
The parameters for setting up DMP with JMS protocol is mentioned below:

<ProviderUrl> </ProviderUrl>
<ConnectionFactory> </ConnectionFactory>
<JMSdestination> </JMSdestination>
<JMSDeliveryMode> </JMSDeliveryMode>
<JMSPriorityLevel> </JMSPriorityLevel>
<JMSTimetoLive> </JMSTimeToLive>
<JMSAcknowledgement> </JMSAcknowledgement>

XML Schema

Schema for JMS

<DownstreamMessagePushDefinition>
   <Event EVENTNAME=" " EVENTMETHOD="JMS" ENV=" ">
   <JmsConfiguration>
        <ProviderUrl> </ProviderUrl>
        <ConnectionFactory> </ConnectionFactory>
        <DestinationName> </DestinationName>
        <DeliveryMode> </DeliveryMode>
        <PriorityLevel> </PriorityLevel>
        <TimetoLive> </TimetoLive>
        <AcknowledgementMode> </AcknowledgementMode>
        <MaxTimeOut> </MaxTimeOut>
   </JmsConfiguration>
   <Security>
       <UserName> </UserName>
       <Password> </Password>
    </Security>
  </Event>
</DownstreamMessagePushDefinition>

Step 4: Configure the DownstreamMessagePushDefinition

  1. Go to the Rules Palette > Global Explorer > Business Rules.
  2. Select System Rule from Business Rule and right-click to select New Global Rule for Category System.
  3. In the New Global Rule window, enter the new business Rule name DownstreamMessagePush and click Next.
  4. Select Company and Plan and select type code as system and click Next.
  5. Click Finish, the DownstreamMessagePushDefinition business rule is created.
  6. Add the below example and checking the rule. For JMS use the below example
    <DownstreamMessagePushDefinition>
       <Event ENV="Development" EVENTMETHOD="JMS" EVENTNAME="Billing">
           <JMSConfiguration>
               <ProviderUrl>tcp://<hostname>:port</ProviderUrl>
               <ConnectionFactory>ConnectionFactory</ConnectionFactory>
               <DestinationName>dynamicQueues/DownstreamMessagePushQueue</DestinationName>
               <MaxTimeOut>1000000</MaxTimeOut>
           </JMSConfiguration>
           <Security>
               <UserName>admin</UserName>
               <Password>6BWYeciXwE/8PJrnWQ7syQ==</Password>
           </Security>
       </Event>
    </DownstreamMessagePushDefinition>
    
    For SOAP use the below example
    <DownstreamMessagePushDefinition>
     <Event EVENTNAME="EVENT_DMPSOAP1" EVENTMETHOD="SOAP" ENV="Development">
         <SoapConfiguration SECURITYTYPE="WSS">
             <WsdlLocation>http://hostname:port/PASJava/FileReceived?wsdl</WsdlLocation>
             <ServiceName>{http://FileReceived}FileReceived</ServiceName>
             <PortName>{http://FileReceived}PasFileReceivedPort</PortName>
             <InvokeOneWay>true</InvokeOneWay>
             <MaxTimeOut>10</MaxTimeOut>
         </SoapConfiguration>
         <Security>
             <UserName>qatester3</UserName>
             <Password>OBc+Mtt4Z7eq4ORb7yUiGg==</Password>
         </Security>
     </Event>
    </DownstreamMessagePushDefinition>
    

    Step 5: Create Transaction

    To create Transaction for the DownstreamMessagePush.
  7. Go to Main Explorer > Companies > Prototype > Subsidiary Companies.
  8. In the Prototype Individual Child Company > Product > Individual Prototype Product > Plans > Functional Prototype Product.
  9. Select Transaction and right-click Transaction and click New Transaction.
  10. In the New Transaction text box, enter the name DownstreamMessagePush and click Next.
  11. Select the Transaction Type as Policy-Financial and click Next.
  12. Add the below configuration and check in the changes.
    <Transaction>
     <EffectiveDate STATUS="Enabled" TYPE="SYSTEM"/>
     <Fields>
         <Field>
             <Name>TextArea1</Name>
             <Display>Text Area 1 Field</Display>
             <DataType>TextArea</DataType>
         </Field>
         <Field>
             <Name>GraceMoney</Name>
             <Display>Grace Money Received</Display>
             <DataType>Money</DataType>
             <Currency>EUR,JPY,THB,TWD,USD</Currency>
             <DefaultValue>0</DefaultValue>
         </Field>
         <Field>
             <Name>SomeDate</Name>
             <Display>Date</Display>
             <DataType>Date</DataType>
         </Field>
         <Field>
             <Name>field2</Name>
             <Display>Grace Money Comment</Display>
             <DataType>Text</DataType>
         </Field>
         <Field>
             <Name>Test</Name>
             <Display>GraceMoney Comment21</Display>
             <DataType>Text</DataType>
         </Field>
         <Field>
             <Name>PolicyCurrencySupportTest1</Name>
             <Display>Bug Retest Currency21</Display>
             <DataType>Money</DataType>
             <DefaultValue>0</DefaultValue>
         </Field>
         <Field>
             <Name>PaymentMode</Name>
             <Display>PaymentMode</Display>
             <DataType>Decimal</DataType>
             <DefaultValue>1</DefaultValue>
         </Field>
     </Fields>
     <Math>
         <MathVariables>
             <MathVariable VARIABLENAME="True" TYPE="VALUE" DATATYPE="TEXT">01</MathVariable>
             <MathVariable VARIABLENAME="False" TYPE="VALUE" DATATYPE="TEXT">00</MathVariable>
             <MathVariable VARIABLENAME="ActivityEffectiveDate" TYPE="DATE" DATATYPE="FORMATDATE" OPERATION="CONVERT" TOFORMAT="YYYY-'W'ww-u">Activity:EffectiveDate</MathVariable>
             <MathVariable VARIABLENAME="EventDateTime" TYPE="DATE" DATATYPE="FORMATDATE" OPERATION="GENERATE" TOFORMAT="YYYY-'W'ww-u"/>
             <MathVariable VARIABLENAME="RequiredMV" TYPE="FIELD" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
             <MathVariable VARIABLENAME="ActivityEffDate" TYPE="FIELD" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
             <MathVariable VARIABLENAME="PaidToDate" TYPE="FIELD" DATATYPE="DATE">Activity:EffectiveDate</MathVariable>
             <MathVariable VARIABLENAME="BigTextMV1" TYPE="FIELD" DATATYPE="BIGTEXT">Activity:TextArea1</MathVariable>
             <MathVariable VARIABLENAME="payerName" TYPE="VALUE" DATATYPE="TEXT">Chris Snow</MathVariable>
             <MathVariable VARIABLENAME="isReBill" TYPE="VALUE" DATATYPE="BOOLEAN">false</MathVariable>
         </MathVariables>
     </Math>
    </Transaction>
    
  13. Go to Admin Explorer tab > Security > Application Security > Security folder.
  14. Select Prototype > Company Security > Transaction Security folder > Prototype Individual Child Company and then right-click to select Grant Access to All Transaction to provide the authorization for the Transaction.
  15. In the Functional Prototype Product > Plan Rule, select EligibleTransactionByPolicy Status add the newly created Transaction "DownstreamMessagePushDefinition".

Step 6: Configure PushNotifications

To configure the PushNotification, perform the following:

  1. Go to the Rules Palette > Global Explorer > Business Rules.
  2. Select Attach Business Rule and right-click Attached Rule and select the New Global Rule for Category "Attached".
  3. The New Global Rule window appears, enter the new business Rule name as PushNotifications and click Next.
  4. Select Transaction and click Next (select the transaction where we want to override this new business rule) and click Next.
  5. Click Finish, then PushNotifications Business rule is created.
  6. Add the below example (configuration) and checking the rule.
    <PushNotifications>
     <Templates>
         <Template ID="Header">
             <JSTLMessage>
                 <Parameters>
                     <Parameter DATATYPE="FORMATDATE" NAME="ActivityEffectiveDate">ActivityEffectiveDate</Parameter>
                     <Parameter DATATYPE="Text" NAME="ActivityGUID">Activity:ActivityGUID</Parameter>
                 </Parameters>
                 <ActivityGUID>[ActivityGUID]</ActivityGUID>
                 <ActivityEffectiveDate>[ActivityEffectiveDate]</ActivityEffectiveDate>
                 <EventDateTime>[EVENTDATETIME]</EventDateTime>
             </JSTLMessage>
         </Template>
         <Template ID="Header1">
             <JSTLMessage>
                 <Parameters>
                     <Parameter DATATYPE="Date" NAME="EFFdate">Activity:EffectiveDate</Parameter>
                 </Parameters>
                 <EffectiveDate>[EFFdate]</EffectiveDate>
             </JSTLMessage>
         </Template>
     </Templates>
     <!-- Sample message template -->
     <PushNotification EVENTNAME="Billing">
         <Message ID="BillingMsg1">
             <Tests>
                 <Test>1=1</Test>
                 <Test>1=1</Test>
             </Tests>
             <AsEventMessage xmlns="http://xmlns.alamere.com/PAS/AsEventMessage">
                 <JSTLTemplate>Header</JSTLTemplate>
                 <JSTLTemplate>Header1</JSTLTemplate>
                 <JSTLMessage>
                     <Parameters>
                         <Parameter DATATYPE="TEXT" NAME="payerName">payerName</Parameter>
                         <Parameter DATATYPE="BOOLEAN" NAME="isReBill">isReBill</Parameter>
                         <Parameter DATATYPE="BIGTEXT" NAME="BigTextMV1">BigTextMV1</Parameter>
                         <Parameter DATATYPE="Date" NAME="RequiredMV">RequiredMV</Parameter>
                     </Parameters>
                     <Billing>
                         <Reversal>[REVERSAL]</Reversal>
                         <BigTextMV1>[BigTextMV1]</BigTextMV1>
                         <payerName>[payerName]</payerName>
                         <isReBill>[isReBill]</isReBill>
                     </Billing>
                     <Premium>
                         <Area>[BigTextMV1]</Area>
                         <Date>[RequiredMV]</Date>
                     </Premium>
                 </JSTLMessage>
             </AsEventMessage>
         </Message>
     </PushNotification>
     <OnPushFailure>
         <RollbackTransaction>Yes</RollbackTransaction>
         <CreateBusinessError>Yes</CreateBusinessError>
     </OnPushFailure>
    </PushNotifications>
    

Step 7: Process Activity in OIPA

  1. Login to OIPA application, go to Policy Activity Screen add the DownstreamMessagePushDefinition transaction configured above from the add activity option.
  2. Enter the values in the fields and save the activity.
  3. Process the activity.
  4. The activity should be processed successfully.

Step 8: To View Messages sent to Downstream systems

Admin Console DB is used to set up admin console for tracking the messages. To view the messages launch SQL Database and in the Admin Console Database, query for AcOutboundEvent table and verify the message sent.