|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value={TYPE,METHOD,FIELD}) public @interface Service
Indicates that the annotated type, field, or method is a bus service endpoint or an RPC endpoint. Bus and RPC endpoints are not mutually exclusive: if a single class qualifies for multiple scenarios outlined below, it can function as bus and RPC endpoints simultaneously.
@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
Optional Element Summary | |
---|---|
String |
value
The name of the bus service. |
public abstract String value
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |