ISO8583 is a STANDARD message format used for credit card transactions, banking and other commercial interaction between different systems.
ISO header (optional)|Message Type|primary bitmap|secondary bitmap (optional)|data fields
The ISO header - is a string containing some code that can vary according to the message type.
The message type - is a number expressed as 4 hex digits (or 2 bytes when using binary format).
The bitmap - is 64 bits long and it is encoded as 16 hex characters or as 8 bytes when using binary format. Every bit that is set in the bitmap indicates that the corresponding field is present. If the first bit is set, then field 1 is present, and so on.
For more information about ISO8583, refer the following link
http://jimmod.com/blog/2011/07/25/jimmys-blog-iso-8583-introduction-beginners-tutorial/
ISO8583 [Inbound+connector] development based on following use-case
The ISO8583 inbound endpoint [1] allows you to consume the ISO8583 standard message which is sent by simple java client [2], and then convert it into xml format by using the message builder to access the ISO8583 messages through WSO2 ESB. Since it is listening inbound, it is listening on port 5000. When the client is connected on port 5000 , ISO8583 inbound starts to consume the ISO8583 standard messages and ISO8583 Messages are inject into the sequence in following XML format.
<ISOMessage>
<data>
<field id="0">0200</field>
<field id="3">568893</field>
<field id="4">000000020000</field>
<field id="7">0110563280</field>
<field id="11">456893</field>
<field id="44">DFGHT</field>
<field id="105">ABCDEFGHIJ 9871236548</field>
</data>
</ISOMessage>
In order to use the ISO8583 inbound endpoint, you need to download the inbound org.wso2.carbon.inbound.iso8583-1.0.0.jar from the https://store.wso2.com/store/assets/esbconnector/ISO8583 or by building the source code https://github.com/wso2-extensions/esb-inbound-iso8583/tree/org.wso2.carbon.inbound.iso8583-1.0.0 ) download the jpos-1.9.4.jar from the http://mvnrepository.com/artifact/org.jpos/jpos/1.9.4 , download jdom-1.1.3.jar from http://mvnrepository.com/artifact/org.jdom/jdom/1.1.3 and download commons-cli-1.3.1.jar from http://mvnrepository.com/artifact/commons-cli/commons-cli/1.3.1 . Then copy the jars to the <ESB_HOME>/repository/components/lib directory. The recommend ESB version is 4.9 and later .
Sample Inbound Configuration
Login with ESB Management console , go to Main --> Home --> Manage --> Service Bus --> Inbound Endpoints and add new endpoint (E.g custom_listener), then update the Inbound Endpoint as in the following UI . Here the Port is the main parameter and the client need to connect with inbound by using the port.
Or you can directly update the following inbound endpoint and request sequence (ISO8583 Messages will inject into this sequence) in Home -- > Manage -- > Service Bus -- > Source View
<inboundEndpoint
class="org.wso2.carbon.inbound.iso8583.listening.ISO8583MessageConsumer"
name="iso8583" onError="fault" sequence="request" suspend="false">
<parameters>
<parameter name="inbound.behavior">listening</parameter>
<parameter name="sequential">true</parameter>
<parameter name="port">5000</parameter>
</parameters>
</inboundEndpoint>
<sequence name="request" onError="fault">
<log level="full"/>
</sequence>
Now you are configured with the inbound and you can test with the inbound. Following is the sample message [a] which is send by simple java-client and the inbound consumes [b] the incoming ISO8583 Message into the sequence, then acknowledge [c] the client by changing the relevant response fields according to the limitations See the link .
[a] 0200B220000100100000000000000002000020134500000050000001115221801234890610000914XYRTUI5269TYUI021ABCDEFGHIJ 1234567890
[b]
INFO - LogMediator To: , MessageID: urn:uuid:F4963E16A27CD0AC2A1473584339729, Direction: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ISOMessage><data><field id="0">0200</field><field id="3">201345</field><field id="4">000000500000</field><field id="7">0111522180</field><field id="11">123489</field><field id="32">100009</field><field id="44">XYRTUI5269TYUI</field><field id="111">ABCDEFGHIJ 1234567890</field></data></ISOMessage></soapenv:Body></soapenv:Envelope>
[c] 0210B22000010210000000000000000200002013450000005000000111522180123489061000090014XYRTUI5269TYUI021ABCDEFGHIJ 1234567890
Note : ISO8583 Inbound acts as a server , Thread pool is used to handle concurrent messages with the inbound. The number of threads in the pool is determined by these variables:
- corePoolSize : The number of threads to keep in the pool , even if they are idle.
- maximumPoolSize : The maximum number of threads to allow in the pool.
The above parameters are optional one . If you need to change the values of these parameters (or let it with the default value), then you can add those parameters in your inbound configuration as below
<inboundEndpoint
class="org.wso2.carbon.inbound.iso8583.listening.ISO8583MessageConsumer"
name="custom_listener" onError="fault" sequence="request" suspend="false">
<parameters>
<parameter name="keepAlive">1</parameter>
<parameter name="maxThreads">2</parameter>
<parameter name="coreThreads">1</parameter>
<parameter name="sequential">true</parameter>
<parameter name="queueLength">1</parameter>
<parameter name="inbound.behavior">listening</parameter>
<parameter name="port">5000</parameter>
</parameters>
</inboundEndpoint>
In following blog you can see, how the connector works with ESB.
References
https://docs.wso2.com/display/ESB490/Custom+Inbound+Endpoint
https://docs.wso2.com/display/ESBCONNECTORS/Configuring+ISO8583+Inbound+Operations
https://github.com/wso2/carbon-mediation/tree/master/components/inbound-endpoints
https://en.wikipedia.org/wiki/ISO_8583
http://jimmod.com/blog/2011/07/26/jimmys-blog-iso-8583-tutorial-build-and-parse-iso-message-using-jpos-library/
https://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html
http://www.javatpoint.com/java-thread-pool
No comments:
Post a Comment