Configuration of the Kafka_InterceptorSample Processes
Kafka_InterceptorSample
The sample project contains two processes and a Java Shared Module. After Importing the Sample Project, expand the Processes resource to display the processes.
This sample project contains the following:
Java Shared Module
Java shared module contains the Java interceptor classes for the SendMessage and ReceiveMessage activities. In the SendMessage activity, the sent message is intercepted by the Java classes in the com.tibco.send.interceptor package. In the ReceiveMessage activity, the received message is intercepted by the ReceiverInterceptor Java class.
KafkaSendMessage.bwp
The KafkaSendMessage.bwp process demonstrates how interceptors can be added to the SendMessage activity to intercept the message before it is published on the server. On the Advanced tab, in the Properties field, an interceptor.property is configured as an additional property. This property is used by the SendMessageInterceptor that is configured in the Interceptors field.
ReceiveMessage.bwp
The ReceiveMessage.bwp process demonstrates how interceptors can be added to the ReceiveMessage activity to intercept the message before it is received by the activity. On the Advanced tab, in the Properties field, an interceptor.property is configured as an additional property. This property is used by the ReceiveInterceptor that is configured in the Interceptors field.
The configure method assigns the value received from interceptor.property to the interceptorProperty variable in the ReceiverInterceptor.java class. The onConsume method prints the received records to check if message value contains the value that is specified in the interceptorProperty.