Search code examples
javalow-latencycommunication-protocol

In-process communication between wars in the same container


What options are there to achieve low-latency communication between two wars running in the same jetty-container?

I basically need to call a service in one war from the other, but can't afford the overhead of calling it as a web service.

Since they are running in the same JVM, I'm hoping to avoid using RMI/JMS etc., but I don't know what other options I have?

I've looked at inter-servlet communication, but since direct method invocation is deprecated that doesn't seem to be the right choice?

I also found kyronet, but are there better solutions since this is in the same JVM?

What I'm looking for is something like Apache Camel's VM Component (seda between web-applications), but since only one of the applications is using Camel for this is not an option.

I know I might have to share some DTO's between the wars, but please don't suggest pulling the service into a shared library, if that was an option I wouldn't be asking this question:)

Edit:

Embedding an EJB-container is probably not an option either.


Solution

  • Register interfaces with JNDI and make them global so that the 'other' servlet can retrieve them from the repository.

    Check this

    (note: we gave up JNDI in favor of our own registry implementation but we start the registry and Jetty programmatically in the same JVM)