@Target(value=TYPE)
@Retention(value=RUNTIME)
@Documented
public @interface Consumer
Consumer of the producer annotated with @send(topic) of the method;
* Topic/queue(1:N or 1:1):
if a class annotated with @Consumer(XX); it must implements
com.jdon.domain.message.DomainEventHandler
the @Send(topicName) ==> @Consumer(topicName);
if there are many consumers, execution order will be
alphabetical list by Name of @Consumer class.
Domain Model producer /Consumer:
1. annotate the producer class with @Model and @Introduce("message")
the @Model
the @Introduce("message")
public class DomainEvent {}
2. annotate the method with @Send("mytopic") of the producer class;
the @Send("mytopic")
public DomainMessage myMethod() {
DomainMessage em = new DomainMessage(this.name);
return em;
}
3. the "mytopic" value in @Send("mytopic") is equals to the "mytopic" value
in @Consumer("mytopic");
4. annotate the consumer class with @Consumer("mytopic");
5. the consumer class must implements
com.jdon.domain.message.DomainEventHandler
'@Consumer("mychannel")'
public class MyDomainEventHandler implements DomainEventHandler {}
- 作者:
- banq
- 另请参阅:
@Send