Connection Pooling for SAF

93 views
Skip to first unread message

Anirudh Singh

unread,
Jan 12, 2017, 3:35:57 PM1/12/17
to jPOS Users
Hi,

I have a scenario in which i have to query the database for security code (which changes). However, i cant get a connection from the session for the SAF.

Can someone help me in the direction to setup a connection pool for SAF as having a new connection for every retry and every transaction is bad

Mark Salter

unread,
Jan 13, 2017, 3:43:16 AM1/13/17
to jPOS Users
Please ask a smart question.


On Thursday, January 12, 2017 at 8:35:57 PM UTC, Anirudh Singh wrote:
Hi,

I have a scenario in which i have to query the database for security code (which changes).
Describe 'database' better.
However, i cant get a connection from the session for the SAF.
Define 'can't get'.
SAF = Store And Forward?

Can someone help me in the direction to setup a connection pool for SAF as having a new connection for every retry and every transaction is bad
More detail is required from you to be able to start to answer sensibly...


... google

     ask a smart question

, read and then reply :-)


--
Mark

Anirudh Singh

unread,
Jan 13, 2017, 6:13:38 AM1/13/17
to jPOS Users


On Friday, January 13, 2017 at 11:43:16 AM UTC+3, Mark Salter wrote:
Please ask a smart question.

On Thursday, January 12, 2017 at 8:35:57 PM UTC, Anirudh Singh wrote:
Hi,

I have a scenario in which i have to query the database for security code (which changes).
Describe 'database' better.
Oracle 11g
However, i cant get a connection from the session for the SAF.
Define 'can't get'.
SAF = Store And Forward?
Yes,
public class CustomSaf extends org.jpos.saf.SAF

Can someone help me in the direction to setup a connection pool for SAF as having a new connection for every retry and every transaction is bad
More detail is required from you to be able to start to answer sensibly...
I need to change a field on the ISOMsg before I send it to mux. To get that field , have to query the database

Mark Salter

unread,
Jan 13, 2017, 6:38:23 AM1/13/17
to jPOS Users
You missed a question; which were only there to guide, not just to answer!


On Friday, January 13, 2017 at 11:13:38 AM UTC, Anirudh Singh wrote: 
However, i cant get a connection from the session for the SAF.
Define 'can't get'.
[here]

... google

     ask a smart question

, read and then reply :-)


and I don't think you followed this guidance yet.

--
Mark

chhil

unread,
Jan 13, 2017, 6:40:00 AM1/13/17
to jPOS Users

Usually a db object is created and placed in the context for all your participants to use the session.

What prevents you from creating a new DB object and let the underlying connection pooling handler configured in your hibernate configuration handle the pooling  for you?

Jposee provides you with the dbsupport module.

https://github.com/jpos/jPOS-EE/blob/master/modules/dbsupport/src/main/java/org/jpos/ee/DB.java

-chhil


--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To post to this group, send email to jpos-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/55a7c8c1-7bc2-414d-b36f-bab3c2fda4a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anirudh Singh

unread,
Jan 13, 2017, 7:06:44 AM1/13/17
to jPOS Users
Thanks for the response.

I can create a new DB object and use connection pooling.

However there is no session that we can maintain for the SAF as there is no context ?

chhil

unread,
Jan 13, 2017, 7:12:30 AM1/13/17
to jPOS Users

Nothing prevents you from creating a qbean that creates a session,  registering it in the nameregistrar and using it from anywhere.

-chhil


Mark Salter

unread,
Jan 14, 2017, 10:58:23 AM1/14/17
to jpos-...@googlegroups.com
On 13/01/17 12:06, Anirudh Singh wrote:
>
> However there is no session that we can maintain for the SAF as there is
> no context ?
What do you mean?

--
Mark

chhil

unread,
Jan 15, 2017, 5:10:49 AM1/15/17
to jpos-...@googlegroups.com
My understanding.... Jpos Saf is an out of band process that unlike regular participants,  does not have a jpos context object associated with it. With a txn mgr the context is passed from participant to participant where one participant creates a db object and places it on the context. 

-chhil 

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.  Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.

Anirudh Singh

unread,
Jan 15, 2017, 5:31:19 AM1/15/17
to jPOS Users
You are absolutely correct chill.

For eg, in participants we can share the same object like this :
Session session = getDB(objCtx).session();

However , in SAF we cannot share the DB object


On Sunday, January 15, 2017 at 1:10:49 PM UTC+3, chhil wrote:
My understanding.... Jpos Saf is an out of band process that unlike regular participants,  does not have a jpos context object associated with it. With a txn mgr the context is passed from participant to participant where one participant creates a db object and places it on the context. 

-chhil 
On Jan 14, 2017 9:28 PM, "'Mark Salter' via jPOS Users" <jpos-...@googlegroups.com> wrote:
On 13/01/17 12:06, Anirudh Singh wrote:
>
> However there is no session that we can maintain for the SAF as there is
> no context ?
What do you mean?

--
Mark

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage.  Please support jPOS, contact: sa...@jpos.org
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

Mark Salter

unread,
Jan 15, 2017, 1:33:06 PM1/15/17
to jpos-...@googlegroups.com
On 15/01/17 10:31, Anirudh Singh wrote:
> However , in SAF we cannot share the DB object
You can access the local space?

You can save and get from there what you need.

So, can I ask just one more time - what can't you do?

--
Mark

Alejandro Revilla

unread,
Jan 15, 2017, 7:21:41 PM1/15/17
to jPOS Users

SAF queues ISOMsgs so it doesn’t need a DB object.

If you implement your own SAF, and you need access to a DB object, you can create one, it’s as simple as calling:

DB db = new DB();
try {
   db.open();
   ...
   ...
} finally (
   db.close();
}

(DB is Closable, so you can also use try (DB db = new DB()) { ... }




To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.

Anirudh Singh

unread,
Jan 16, 2017, 12:29:24 AM1/16/17
to jPOS Users
Hi ,

Thanks for the response.

We implemented out own SAF in the same way as you suggested about a week back.

However, we were experiencing a lot of performance issue.

I believe the connections to the DB were too many because of such implementation ?

At some point, we even saw the DB go down.


chhil

unread,
Jan 16, 2017, 12:37:27 AM1/16/17
to jPOS Users

We have various components that need to open and close connections independently. You should check for connection leaks and tune your db with indexes to make sure you are not doing table scans.

-chhil


Mark Salter

unread,
Jan 16, 2017, 2:21:57 AM1/16/17
to jpos-...@googlegroups.com
On 16/01/17 05:29, Anirudh Singh wrote:
> We implemented out own SAF in the same way as you suggested about a week
> back.
>
> However, we were experiencing a lot of performance issue.
>
> I believe the connections to the DB were too many because of such
> implementation ?
>
> At some point, we even saw the DB go down.
Finally - the actual question, if only it had been smart at the start.

--
Mark

Anirudh Singh

unread,
Jan 16, 2017, 3:28:25 AM1/16/17
to jPOS Users
For eg - An Application is going through 200 TPS, and due to some reason the transactions were reversed and put into the SAF.

Now the SAF checks if the Authorization happened at the issuer via Database  so that it can reverse them. (A reversal without authorization is no use)

Now every second having 200 DB object wont cause performance impact ?

chhil

unread,
Jan 16, 2017, 3:52:07 AM1/16/17
to jPOS Users

There is one instance of the SAF and one instance of your DB object.
The session opens and closes per entry in the SAF. The saf sends entries one at a time.
You can use the db object

Usually when you send an Auth and don't receive a response you create the reversal for it and SAF the reversal because you never know if the no response means the auth went through and response got lost and if the auth did not reach the other entity it would not find the original and will not be able to reverse it and inform you with an appropriate response code. So your contention of no need to reverse if authorization did not happen does not appear to be a valid one.

-chhil


Anirudh Singh

unread,
Jan 16, 2017, 4:05:09 AM1/16/17
to jPOS Users
Hi,

Thanks for the response.

My contention is to resolve below :

The authorization happens, however sometimes it takes a lot of time (more than 15 secs) due to some network problem. So a reversal is only processed once the auth actually happens.
The other major problem is that, the card issuer is a stupid team which does not notify whether the reversal actually happened against a valid authorization. The stupid card issuer always sends Approved response even when there might be no authorization at that point in time.

chhil

unread,
Jan 16, 2017, 8:13:06 AM1/16/17
to jpos-...@googlegroups.com
I don't think the card issuer team is "stupid" or is not following EFT rules.
When an advice (reversal in your case) is sent 99.99% times it will come back as approved else you will retry till you get a response code you expect. From your perspective its done once you get approved action code, you told it reverse and it did what it was supposed to do.

What you need to do is when the auth response does not come back, or is late,  you need to decline the transaction to the entity that sent it and you must reverse the tran. Your card issuer will reverse the financial impact if any with the reversal.

-chhil


To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.

Anirudh Singh

unread,
Jan 17, 2017, 11:34:46 AM1/17/17
to jPOS Users
How can i check or keep track how much time the current auth transaction has taken while its going through the trxn manager ? Maybe use the profiler ?

chhil

unread,
Jan 17, 2017, 12:26:45 PM1/17/17
to jpos-...@googlegroups.com
You can put current nano seconds in your context when its created before you put it on the txn mgr queue. Then calculate the time difference in your participant that needs the time spent.

-chhil

To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+unsubscribe@googlegroups.com.

To post to this group, send email to jpos-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages