Miguel Pascal
Miguel Pascal

Reputation: 11

How to use Jpos to dynamicaly route my message using a criteria in my xml message?

1- As far as my knowledge, we can receive an ISO8583 message from one host do some processing, and forward the message to another host using server.xml, channel.xml, and mux.xml config files.

2- We can route the message based on the IP config that is specified in channel.xml which is static (in the sense it is predefined).

Requirement: I want to develop an application using the JPOS Q2 Server as a payment gateway router. The basic requirement is that Q2 server must be able to route the incoming message based on one field(as an identifier) from that incoming message, pick up the destination route from the Database dynamically, and send the message further to the destination host. Is this can be accomplished using the JPOS Q2 Server? If yes, how?

Message Flow: Source -> (ISO message with a select field as identifier)-> Q2 SERVER->(Do some processing, gets the destination address using identifier from DB)->Destination Host->(Respond back to the source in reverse)

Now I have been able to create my own server by modifying the XML configuration for the server. I also modify my XML file to define the channel and the ip address where the iso message will be sent

Upvotes: 1

Views: 255

Answers (3)

apr
apr

Reputation: 1343

Take a look at the SelectDestination participant that you can use as an example:

https://github.com/jpos/jPOS/blob/master/jpos/src/main/java/org/jpos/transaction/participant/SelectDestination.java

SelectDestination is documented in section 9.8.3 of the jPOS Programmer's guide that you can download here: http://jpos.org/doc/proguide.pdf

Upvotes: 0

Miguel Pascal
Miguel Pascal

Reputation: 11

I have been able to solve this issue by using a config file containing routing rules. I defined also Mux for each channel i wanted to reach. enter image description here This work for me. Now i have another challenge

Upvotes: 0

Andrés Alcarraz
Andrés Alcarraz

Reputation: 1865

Short answer, it is doable.

Long answer, I would do that in a transaction manager, and you would have to implement a transaction participant that access the database to do that.

You can base your implementation in SelectDestination but adding the logic to get the destination from the database.

You'll want to use the jPOS-EE dbsupport module for that, you can learn how to use it if you don't already know by reading the jPOS-EE documentation.

For a more detailed answer you should provide relevant pieces of your configuration, and database setup, like tables used to route, etc.

Upvotes: 0

Related Questions