-
1. Re: Singleton cluster service
pavel.orehov Mar 18, 2012 10:00 AM (in response to pavel.orehov)Still looking for the answer.
-
2. Re: Singleton cluster service
jaikiran Mar 19, 2012 2:15 AM (in response to pavel.orehov)See if this helps https://community.jboss.org/message/646537#646537
-
3. Re: Singleton cluster service
pferraro Mar 19, 2012 5:50 PM (in response to pavel.orehov)There's an example of using SingletonService here:
In summary, you can use SingletonService to decorate a Service<?> such that the service will only ever be started on one node in a cluster at any given time.
-
4. Re: Singleton cluster service
radzish Jun 22, 2012 8:15 AM (in response to pferraro)Hi Paul,
This example works fine bu failes when application is redeployed. Service is failed to start second time. Can you suggest how to fix it ?
-
5. Re: Singleton cluster service
pgmjsd Jun 29, 2012 6:40 PM (in response to pferraro)Paul,
I've got an AS5 app that use a POJO service bean cluster singleton, just like Pavel (and others)l. I looked over this example, and I'm not sure how I would use that in the place of what I now have in AS5: A cluster singleton service that can be accessed from any node on the cluster by looking it up in HAJNDI.
- How do you access this cluster singleton MSC bean from other nodes in the cluster?
- It looks like the MSC bean has only the one getValue() method that can be called. AS5 POJO service beans have regular EJB-like interfaces with many methods. Is the MSC bean supposed to register a remote interface to a singleton EJB somehow?
All I realy need is a way to get a remote interface to a singleton on the cluster.
-
6. Re: Singleton cluster service
wdfink Jun 30, 2012 12:55 PM (in response to pgmjsd)You may have a look into the quickstart overview and this cluster-ha-singleton-ejb quickstart
-
7. Re: Singleton cluster service
pgmjsd Jul 1, 2012 6:28 PM (in response to wdfink)I've cloned that repo and switched to the cluster-hasingleton-ejb branch. I get the part where you are using an SLSB remote interface called ServiceAccess to provide access to the service, and I see how ServiceAccessBean is locating the real service and delegating to it. This is exactly what I'm doing in my app, except the inner service is a POJO Service, which the SLSB looks up in HA-JNDI.
I'm not sure this answers my second question. In this example EnvironmentService is the cluster singleton, right? It only has a 'getValue()' method as far as I can tell. Can it have other methods that are called from ServiceAccessBean? In AS5, you could make a POJO service with an interface that had as many methods as you wanted.
-
8. Re: Singleton cluster service
pferraro Jul 2, 2012 1:11 PM (in response to pgmjsd)The EnvironmentService referenced in the quickstart is a simple Service<String> whose getValue() returns a String. The target type of a service can be whatever you want, e.g. Service<ServiceAcccess>.
-
9. Re: Singleton cluster service
pgmjsd Jul 2, 2012 2:56 PM (in response to pferraro)Thanks Paul. So the service can be sort of a 'provider'... okay, but how would it return something that other nodes on the cluster can call? Would the MBean implementation implement the business interface as well as the Service<?> interface? I guess I don't really understand the 'service' concept that well. It seems very different from the AS 5 POJO service definition.
-
10. Re: Singleton cluster service
pgmjsd Jul 2, 2012 3:14 PM (in response to pgmjsd)I read this in the Javadoc for org.jboss.msc.service.Service<T>:
The value type specified by this service is used by default by consumers of this service, and should represent the public interface of this service, which may or may not be the same as the implementing type of this service.
So, that means the service MBean can implement another interface and return itself via getValue()?
-
-
12. Re: Singleton cluster service
pgmjsd Jul 5, 2012 4:08 PM (in response to pferraro)Thanks Paul. One more thing, just to make sure I understand before I go off and try it ...
public class MyServiceBean implements implements Service<MyInterface>, MyInterface { ... public MyBusinessInterface getValue() { return this; } ... }
The return value will be remotely invokeable from all other nodes in the cluster?
-
13. Re: Singleton cluster service
wesjanik Sep 5, 2012 10:22 PM (in response to pgmjsd)Hi Joshua - did you ever resolve this issue?
I'm struggling with the same scenario. I'm looking for a way to return something akin to a remote EJB proxy pointing specifically to the node the singleton service is running on. However, if I understand the JBoss remote proxies correctly, they purposely don't point to the node they were created on. In other words, if MyServiceBean in your example above looks up a remote reference to an EJB and returns that reference from getValue, that proxy isn't guaranteed to invoke the bean on the singleton node when it is used on some other node in the cluster.
In essense, I'm trying to find a way to get something useful out of getValue that will allow me to invoke methods on an EJB guaranteed to be within the same node as the singleton service. Any ideas are greatly appreciated.
-
14. Re: Singleton cluster service
pgmjsd Sep 7, 2012 7:46 AM (in response to wesjanik)I have not had a chance to fully try out what Paul suggested. Busy with other things at the moment.