@Retention(value=RUNTIME) @Target(value={TYPE,METHOD,FIELD}) public @interface Service
@Service
annotation
implements a Remote
interface, then it is an RPC endpoint.
The following example service has two RPC-callable methods. It implements the
ficticious MyService interface, which would be annotated with Remote
.
@Service
public class MyServiceImpl implements MyService {@Override
public void serviceMethod1() { ... }@Override
public ReturnType serviceMethod2(ParameterType arg) { ... } }
@Service
annotation is a class that
implements MessageCallback
, then it is a bus service endpoint. If the
target is a method that accepts a single parameter of type Message
,
then that method is a bus endpoint. Multiple such methods are permitted
within the same class, and each one defines a distinct endpoint. In this
case, a single instance of the class will be instantiated and that instance
will receive callbacks for all subjects it is registered for.
Within a class annotated with @Service
, it is possible to define
multiple named endpoints known as commands. See the Command
documentation for details.
@Service
public class MyBusService implements MessageCallback {@Override
public void callback(Message message) { ... } }
public class MyBusThingy {@Service
public void myServiceName(Message message) { ... }@Service
public void myOtherService(Message message) { ... } }
Remote
,
MessageCallback
,
Command
public abstract String value
Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.