Generate Dynamic Queue in PI Java Only.
We have requirement to generate gueue, that depends on some key from inbound xml message.
What for? We can use Encoded Headers in Sender channel, add &QueueId= to endpoint url of ICO. But client can’t agree to change url, add parameters. Client wants one unchangeable endpoint and send QUEUE name in inbound xml message.
What can we do in this situation?
We can use two Iflow. How to use Iflow-Iflow read in this blog.
First Iflow will have unchangeable URL and EOIO Sender Channel with some QUEUE name.
Receiver channel will be a little tricky.
Channel: SOAP HTTP.
Target URL: http://
ASMA and Transport Binding checked.
Variable Header (XheaderName1): TserverLocation
Variable Header (XheaderName2): TAuthKey
We will set this variables in Operation Mapping in this first flow.
Server Location we use for set URL with parameter &QueueId= in Target URL of Receiver Channel, TauthKey we use for set user credentials (user that will run second IFlow).
+ add View Authorization Key witn username and password.
Key: username
Password: user password.
Receiver Channel Configuration in first Iflow:
UDF for set this values (var1 used for QUEUE_NAME):
@LibraryMethod(title="GenerateQueue", description="", category="FL_local", type=ExecutionType.SINGLE_VALUE)
public String calculate1 (
@Argument(title="") String var1,
Container container) throws StreamTransformationException{
//Get the dynamic configuration from the container
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP", "TServerLocation");
String varURL = "http://[host:port]/XISOAPAdapter/MessageServlet?senderService=TEST_BC&interface=SIOA_AAA&interfaceNamespace=http://some.ns&QueueId=Q" +var1;
//Put the url value from the input in the configuration under the specified key
conf.put(key,varURL);
key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP", "TAuthKey");
conf.put(key,"username");
//return the data for mapping to the output
return var1;
}
Use this code in OM in First Iflow.
But this have some limitation on TServerLocation length. 200 symbols max. So, don’t give your queues and interfaces long names, if you want to implement this.
Then in second Iflow you need to configure Sender Channel:
Channel: SOAP HTTP
Keep Headers, Use Encoded Headers, Use Query String checked
QoS: EOIO with DummyQueueName (this will be changed from Receiver Channel of First Iflow)
Remaining configuration is straightforward.
Have fun 🙂