Hello,
I'm currently migrating application from JBoss-AS-5 to JBoss-EAP-6 and I would like to use this migration to improve our architecture.
We have two servers which have to communicate together. Until now, we use a JNDI lookup to get remote EJB.
Each EJB implements two interfaces :
- Remote interface,
- Local interface.
They describe the same functions but remote interface need an additional parameter, always the same.
For example :
public interface LocalInterface {
void foo(String fooName);
String bar(Integer barId, String barName);
...
}
public interface RemoteInterface {
void foo(Integer remoteId, String fooName);
String bar(Integer remoteId, Integer barId, String barName);
...
}
@Local
@Remote
@Stateless
public class MyImplementation implements LocalInterface, RemoteInterface {
...
public void foo(String fooName) {
}
public String bar(Integer barId, String barName) {
}
public void foo(Integer remoteId, String fooName) {
log.info(remoteId);
foo(fooName);
}
public String bar(Integer remoteId, Integer barId, String barName) {
log.info(remoteId);
bar(barId, barName);
}
...
}
I would like to use only one interface and use an @Interceptor to log the remoteId.
I tried to manipulate InitialContext and SessionContext to set the remoteId from the caller class but it does not work and I don't really know what I have to search.
I have also to call remote EJB from standalone application.
Any idea?
Thanks in advance for you help!
Nicolas