views:

98

answers:

5

I'm new to this and is looking at Apache Camel, Spring Integration and even Terracotta.

I'm looking at sharing of common data like user/groups/account/permission and common business data like inventory/product details/etc.

Any example will be really appreciated.

A: 

In theory, every application has its own memory space, but off the top of my head I can think of a number of methods for sharing information between applications.

If the amount of shared information is small, perhaps a direct approach is best. set up a communication channel (web services are a bit of an overkill, but a good example) and have the applications request info from each other.

If there is massive sharing, perhaps the two applications should be reading from the same database or local file. Mind you, This brings up synchronization issues, and gets you into the realm of lockings and blockings. Tread lightly in this realm...

Yuval
Yup, exactly the reason why we are looking into Messaging pattern.
Seymour Cakes
+1  A: 

How about database-level integration?

Have both applications access the same relational database. Those are built for that kind of task.

To do that, the two applications can use a shared library (of which for the sake of simplicity each one will have a copy in their WEB-INF/lib).

Thilo
No, the db is separated, as best possible we want to avoid sharing of database.
Seymour Cakes
In this case, you should probably have a third application that manages the common data and exposes it via some clean interface, such as a web service. (Of course the other applications can still keep local caches for some data, if you feel that is necessary and can make sure that you got the synchronization issues sorted out).
Thilo
+1  A: 

You should consider creating a full blown EAR instead, if you want this to be web container independent.

As different web applications have different classloaders you cannot just create an object in one web app which is immediately usable by another. Hence you need to have a common classloader which knows about the classes in common, and - to be 100% compliant - these classes may not be in either web apps WEB-INF/lib. This is hard to get right, and the result is fragile.

Therefore consider migrating to a web container which can deploy EAR's instead as they may contain several web applications sharing objects. I believe a good choice for starting would be JBoss.

Thorbjørn Ravn Andersen
He did ask for "the simplest solution", though...
Thilo
In this particular case, it might very well be.
Thorbjørn Ravn Andersen
A: 

If your new an idea may be to build the classes to handle the common data and just build a separate servlet for each application.

This will at least get you started and more familiar with the technologies.

MontyBongo
+1  A: 

I'm looking at sharing of common data like user/groups/account/permission and common business data like inventory/product details/etc.

Common data like users, groups, and permissions belong in a central LDAP or database. These are part of your Spring Security solution, and all apps can share those regardless of whether they're on the same app server or not.

It can be argued that common business data like inventory, product details, etc. should be "owned" by a single service. It's the only one that can modify the data. Others can get access by querying the service, but it's the one that manages CRUD operations on those tables.

If you do this, you keep objects and systems from being coupled at the database level. You're trading looser coupling for increased network latency.

duffymo