want to use load balancer while doing lookup , so that request can go to multiple instances for EJB

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

want to use load balancer while doing lookup , so that request can go to multiple instances for EJB

VikasRathee
Hi

In my application , from  web module, I want to access EJBModule deployed on
multiple instances.
So I want to add something like load balancer while doing lookup. What i
need to do.

            /  Properties properties = new Properties();
            properties.put(Context.INITIAL_CONTEXT_FACTORY,
          "org.apache.openejb.client.RemoteInitialContextFactory");
            properties.put(Context.PROVIDER_URL,
"http://127.0.0.1:8081/tomee/ejb");
            InitialContext ic=new InitialContext(properties);/

This code is working fine with one PROVIDER_URL, but if i'm giving other URL
also with comma separated, i'm getting naming exception.
Is there anything like i can implement a EJB broker kind of thing which can
manage requests to multiple app servers.





--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html
Reply | Threaded
Open this post in threaded view
|

Re: want to use load balancer while doing lookup , so that request can go to multiple instances for EJB

Romain Manni-Bucau
Hi

You can use failover:url1,url2 or failover:roundrobin:url1,url2 for
instance to pass multiple instance. If you want a custom strategy just do N
lookups and implement a proxy with the custom strategy - like circuit
breaker for instance.

Le 16 sept. 2017 04:35, "VikasRathee" <[hidden email]> a écrit :

> Hi
>
> In my application , from  web module, I want to access EJBModule deployed
> on
> multiple instances.
> So I want to add something like load balancer while doing lookup. What i
> need to do.
>
>             /  Properties properties = new Properties();
>             properties.put(Context.INITIAL_CONTEXT_FACTORY,
>           "org.apache.openejb.client.RemoteInitialContextFactory");
>             properties.put(Context.PROVIDER_URL,
> "http://127.0.0.1:8081/tomee/ejb");
>             InitialContext ic=new InitialContext(properties);/
>
> This code is working fine with one PROVIDER_URL, but if i'm giving other
> URL
> also with comma separated, i'm getting naming exception.
> Is there anything like i can implement a EJB broker kind of thing which can
> manage requests to multiple app servers.
>
>
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-
> f982480.html
>
Reply | Threaded
Open this post in threaded view
|

Re: want to use load balancer while doing lookup , so that request can go to multiple instances for EJB

David Blevins-2
In reply to this post by VikasRathee
Hi Vikas,

Definitely check out this section of the documentation:

 - http://tomee.apache.org/ejb-failover.html

The "failover:" URL prefix Romain mentions is one of a handful of features you can use.  The "failover:" strategy is great if you don't need dynamic loadbalancing and you are ok to fix the list statically on the client side.

There are also two options for having just one or two fixed and the rest discovered dynamically allowing for you to add/remove servers at runtime.  It's effectively the same as the "failover:" approach, but now the client will get an always up-to-date list dynamically.

If you happen to be in AWS this would be the one you need:

 - http://tomee.apache.org/multipoint-discovery.html
 - http://tomee.apache.org/multipoint-recommendations.html


--
David Blevins
http://twitter.com/dblevins
http://www.tomitribe.com

> On Sep 15, 2017, at 5:05 AM, VikasRathee <[hidden email]> wrote:
>
> Hi
>
> In my application , from  web module, I want to access EJBModule deployed on
> multiple instances.
> So I want to add something like load balancer while doing lookup. What i
> need to do.
>
>            /  Properties properties = new Properties();
>            properties.put(Context.INITIAL_CONTEXT_FACTORY,
>          "org.apache.openejb.client.RemoteInitialContextFactory");
>            properties.put(Context.PROVIDER_URL,
> "http://127.0.0.1:8081/tomee/ejb");
>            InitialContext ic=new InitialContext(properties);/
>
> This code is working fine with one PROVIDER_URL, but if i'm giving other URL
> also with comma separated, i'm getting naming exception.
> Is there anything like i can implement a EJB broker kind of thing which can
> manage requests to multiple app servers.
>
>
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html