jeudi 27 avril 2017

Dynamic Remote EJB call

I am looking since a long time but actually have not found the correct answer for my case.

General I want to call a remote EJB without knowing all the methodes of it. As far I know, I need to use reflection to accomplish it.

The thing is should I use an interface on client side or not? Normally I use an interface for EJB calls, but I guess I need to use bytecode manipulation to create an dynamic interface at runtime???

Finally the idea is to deploy new applications to the jboss server at runtime (hotdeploy) and call the EJB from the new deployed application via the admin server (main application from the EJB). So I can add/delete/update logic/EJBs during runtime.

But the remote EJB is not every time the same (depends on the task it should execute). So I need to create an interface or class dynamically for each new deployed application/ejb I want to call. Client/admin just know the JNDI name.

Let's assume this is my interface and ejb code from a hotdeployed application. Please consider this is only one EJB out of n.

Remote EJB Interface:

import javax.ejb.Remote;

@Remote
public interface EJBInterface {

    public void www();
    public void store();
}

Remote EJB:

import javax.ejb.Stateless;

import com.xx.yy.EJBInterface;

@Stateless
public class EJBStuff implements EJBInterface{

    @Override
    public void www() {
       //Do some stuff
    }

    @Override
    public void store() {
       //Do some stuff
    }
}

On client/admin side I would like to call the EJB. Should I use an interface or direct a class for the implementation??? Further I assume I need to add a common EJB to each hotdeploy app, which provides me the information from the EJB I want to call so I can create an class or interface at client/admin side.

So does someone has an adivse if I should create an interface on client/admin side or a class and call the EJB without interface view??? To I need another class with provides me the info from the remote EJB???

Thanks in advise.





Aucun commentaire:

Enregistrer un commentaire