Indiver kumar
Indiver kumar

Reputation: 15

Use of OSGI In financial domain projects or realtime applications

OSGI gives on the fly bundle update. In multiplayer gaming project you have multiple socket connections and its related functionality around that. there will be so many socket connection and there will be so many payment requests would be going on like in financial project.

I just want the benefit of on the fly bundle update. If i have two modules one for socket connection and its related functionality and other transaction module. If i am updating transaction module bundle. Wouldn't it effect my requests. Because somehow JVM has to reload jar. Can we use OSGI in this case if not in what kind of application, we can use OSGI.

Upvotes: 0

Views: 58

Answers (1)

Christian Schneider
Christian Schneider

Reputation: 19606

Let me formulate your question in a more abstract way. Lets assume your communication module talks to the transaction module using an OSGi service.

So you have a service dependency between two bundles and want the calling bundle to no be affected by the update.

If you do this using plain declarative services then you have a mandatory service reference in a component in bundle A. When you update the bundle B it will be first stopped, then updated then started again. So the service vanishes and then comes back again. With a simple mandatory reference you component in bundle A will also be stopped and then started again. In this case you have to close the connections for a short time which might cause lost connections.

What you can do is to not have a mandatory reference but a optional dynamic reference. In this case your component in bundle A stays up but has to deal with the service from be not being present for a short period. Maybe you can simply block until the service is back. In this case you can provide uninterrupted processing but you are blocking threads.

So a better solution might be to use a jms server to communicate between the bundles. If you want it small the jms server can be embedded and purely in memory (ActiveMQ can do that). In this case you can update the bundle B without interruption.

In both cases it can help to use a web server with continuation support to avoid blocking.

Upvotes: 2

Related Questions