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