jPOS Space Tips

Today i want to review about Chapter 7 on jPOS Programmer guide.
from the programmer guide,

jPOS’s Space is a general-purpose coordination component inspired after The Linda Coordination Language.

You can think about jPOS’s Space component as being like a Map where its entries are lists of objects and its operations are fully synchronized.

I think, space is very usefull. In this post, i will share some jPOS Space Tips. we can communicate between servers and clients on deployed jPOS application. For example on my post jPOS client receive response specific port i use space for store the response with bit 11 as a key using Space.out(bit11, ISOMsg) and getting the response using Space.in(bit11, timeout) method.

Another oportunity while using jPOS Space is for temporary storage. In my case, there are two messaging type for payment: inquiry and flagging. see the diagram below:

jPOS Space Tips

when i send flagging message to server i need some data from inquiry response, we can save the inquiry response into database, file, or memory. Of course using memory is best solution, becouse IO operation will very expensive. when there are dozens thread coming, it will very very expensive when using database or file moreover with so many data saved.

I sugest you to use Space.out(Object key, Object value, long timeout) method, it will place object into space using expiration timeout. The entry is automatically removed upon expiration.
and, you can read the object from space with Space.read(Object key, long timeout) or Space.in(Object key, long timeout) if you didn’t need the object anymore.

Another case is, if you have an configuration and want to refresh the configuration variable values on given a time, you can place the object into space and give it timeout, if the space return null when getting the object you will get the value from database, and save to the space.

Hope this post about jPOS Space Tips can help someone. Thanks for visiting my blog.

Leave a Reply

Your email address will not be published. Required fields are marked *