Skip to Content
Author's profile photo Artem Solohin

Adapter Module Development. Set QoS EOIO with Queue Name based on XPath expression

This adapter module allow you to set EOIO QoS and Queue ID in sender channel (even it was configured as EO). Queue Id can be setted as fixed value, or as value from Payload (using XPath).

Module has two parameters: QueueName and XPath.

SenderChannel.PNG

Parameter QueueName is mandatory. Even you fill XPath parameter, you should set QueueName (with any non-empty value).

XPath example for PI message:

For example, we have this message:

<ns0:MT_1 xmlns:ns0='someuri'>
<item>
<ThisIsWillBeUsedForQueueName>1</ThisIsWillBeUsedForQueueName>
</item>
</ns0:MT_1>

Xpath is: //item/ThisIsWillBeUsedForQueueName

In the message Data log you will see (even it is EO sender channel):

    Quality of Service Exactly Once in Order

    Sequence ID : <value from your QueueName or XPath result>

Code of Module in the attachment (this is for PI 7.4, for others may be some differences)

Useful links to create Module:

http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/08/08/pi-74–adapter-module-creation-using-ejb-30

And check comments 😉

ℹ Note: even you select XPI Libraries you can’t add Audit, cause in those libraries is missing one important file com.sap.aii.af.svc_api.jar

You can get it from PI server. Very very great blog for it: http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/10/19/how-to-locate-java-library-resource-during-java-development-in-pi

Another useful link: http://wiki.scn.sap.com/wiki/display/NWTech/Custom+Adapter+Module+Development+-+SAP+PI+7.1

There I found how to get payload.

Have fun 🙂

PS. If you know, how to optimize it or do better – write in comments please. Thx

PPS. Another blog about : http://scn.sap.com/community/pi-and-soa-middleware/blog/2015/01/29/create-sap-pi-adapter-modules-in-ejb-30-standard

Useful links:

Adapter module: Set the file name from Payload using Regular Expression (Regex).

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Eng Swee Yeoh
      Eng Swee Yeoh

      Hi Artem,

      Thanks for sharing your development 🙂

      Regarding your note on the library file, it is really not required to have that "missing" JAR file. There is an alternative method to access the audit log, which is via com.sap.engine.interfaces.messaging.api.auditlog.AuditAccess. This is already included in the NWDS XPI library.

      Below is an example of how to instantiate an object of AuditAccess and use its instance method to add an entry in the audit log.

      AuditAccess audit = PublicAPIAccessFactory.getPublicAPIAccess().getAuditAccess();

      audit.addAuditLogEntry(msgkey, AuditLogStatus.ERROR, "Error");

      This method is also documented in the following official module development guide from SAP.

      Developing User Enhancement Modules in the Adapter Engine

      How to Create Modules for the JEE Adapter Engine

      I have this logic in a few custom adapter modules and they are all working perfectly fine.

      Rgds

      Eng Swee

      Author's profile photo Former Member
      Former Member

      Artem, I don't seem to be able to find an attachment with the code for module anywhere in the post.

      Author's profile photo Evgeniy Kolmakov
      Evgeniy Kolmakov

      Hello, Alexei!

      Here you’ll find the blog describing how to assign queue name and QoS to source message (with module code):

      https://blogs.sap.com/2012/09/24/setting-queue-dynamically-using-adapter-module/

      And here is another one:

      https://blogs.sap.com/2011/04/13/dynamic-eoio-queue-derivation-with-adapter-modules/

      Regards, Evgeniy.

      Author's profile photo Artem Solohin
      Artem Solohin
      Blog Post Author

      Аттачменты потерлись видимо после переезда. Жаль. Я их не сохранял в другом месте.

      Author's profile photo Artem Solohin
      Artem Solohin
      Blog Post Author

      https://blogs.sap.com/2016/08/15/setting-dynamic-queue-name-in-eoio-scenarios/

      Author's profile photo Bo Yang
      Bo Yang

      Hi Artem Solohin,

      Could you please share you Java code ? I can't find you attachement.

       

      Thanks,