How to change destinations for JMS activities dynamically using the TIBCO ActiveMatrix BusinessWorks ActiveAspects Plug-in.

How to change destinations for JMS activities dynamically using the TIBCO ActiveMatrix BusinessWorks ActiveAspects Plug-in.

book

Article ID: KB0092793

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks ActiveAspects Plug-in -
Not Applicable -

Description

Description:
TIBCO ActiveMatrix BusinessWorks ActiveAspects Plug-in (BWAA) can be used to change destinations for JMS activities dynamically. Considering the scenarios in which there is a need for BW applications to be able to switch destinations based on environments or some field in the headers of a JMS message.



Environment

Product: TIBCO ActiveMatrix BusinessWorks ActiveAspects Plug-in Version: 1.2.0.1 OS: All Supported Operating Systems

Resolution

To set dynamic destinations, configure the aspect and implement logic in the implementation for conditions to change a destination. In the attached sample code (Filename: Scenario3.7z), the aspect is configured to change the destination using BWAA.

Details about the implementation.


- Added a property(destinationToModifyValue) to change the destination from testDestination to test. The message will be consume by ChangedDestination process, not the EventSource.

- Changes in file Aspect.bwaspect added the following to have new a destination name.

<property name = "destinationToModifyValue">test</property>

implementation file (JMSPropertyChangerWithConfig.java) changes to modify destination.

public String destinationToModifyValue = "test";
static final String JMS_DESTINATION_NAME = "destinationQueue";//OtherProperties
private S userDestinationName;
 userDestinationName = nameBridge.symbolize(JMS_DESTINATION_NAME);
 N userDest = model.getFirstChildElementByName(firstChild, userPropsNs, userDestinationName);

if(userDest != null)
{
    System.out.println("********************************");
    System.out.println("Current destination is: " + model.getStringValue(userDest));
    System.out.println("new destination is: " + destinationToModifyValue);
    System.out.println("********************************");
   
    try {
            GxmlUtils.setNodeStringValue(userDest, destinationToModifyValue, pcx);
        } catch (GxAtomCastException e) {
        System.out.println("----------[ADVICE EXECUTION FAILED]----------");
        System.out.println(e.getMessage());
        }
}


The following changes needs to be made to run the sample code.

1). Set the EMS/JMS connection settings as per your EMS configurations.
2). Put the aspects.jar file provided in the attachment in your Aspects folder, i.e TIBCO_HOME\bw\plugins\bwaa\aspects
3). Put the poa-bwaa-samplesImpl-src.jar file provided in the attachment in your lib folder, i.e., TIBCO_HOME\bw\plugins\bwaa\lib

Issue/Introduction

How to change destinations for JMS activities dynamically using the TIBCO ActiveMatrix BusinessWorks ActiveAspects Plug-in.

Attachments

How to change destinations for JMS activities dynamically using the TIBCO ActiveMatrix BusinessWorks ActiveAspects Plug-in. get_app