-
Notifications
You must be signed in to change notification settings - Fork 223
Closed
Labels
Description
For the intercepter APIs .
io.openmessaging.interceptor.ProducerInterceptor
io.openmessaging.interceptor.ConsumerInterceptor
It would be convenient for user to support java8 lambda style, that also make code more elegant.
Separating the preSend and the postSend method gives user more chorices.
Take a look the following example code:
Before:
ProducerInterceptor interceptor = new ProducerInterceptor() {
@Override
public void preSend(Message message, Context attributes) {
System.out.println("PreSend message: " + message);
}
@Override
public void postSend(Message message, Context attributes) {
System.out.println("PostSend message: " + message);
}
};
producer.addInterceptor(interceptor);
After:
producer.addPreSendInterceptor((message, attributes) ->
System.out.println("PreSend message: " + message));
producer.addPostSendInterceptor((message, attributes) ->
System.out.println("PostSend message: " + message));
Reactions are currently unavailable