-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0f1fb5
commit aff3c11
Showing
15 changed files
with
351 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
documentation/src/main/java/kafka/outbound/ProducerInterceptorBeanExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package kafka.outbound; | ||
|
||
import java.util.Map; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import org.apache.kafka.clients.producer.ProducerInterceptor; | ||
import org.apache.kafka.clients.producer.ProducerRecord; | ||
import org.apache.kafka.clients.producer.RecordMetadata; | ||
|
||
import io.smallrye.common.annotation.Identifier; | ||
|
||
@ApplicationScoped | ||
@Identifier("my-producer-interceptor") | ||
public class ProducerInterceptorBeanExample implements ProducerInterceptor<Integer, String> { | ||
|
||
@Override | ||
public ProducerRecord<Integer, String> onSend(ProducerRecord<Integer, String> producerRecord) { | ||
// called before send | ||
return producerRecord; | ||
} | ||
|
||
@Override | ||
public void onAcknowledgement(RecordMetadata recordMetadata, Exception e) { | ||
// called on send acknowledgement callback | ||
} | ||
|
||
@Override | ||
public void close() { | ||
// called on client close | ||
} | ||
|
||
@Override | ||
public void configure(Map<String, ?> map) { | ||
// called on client configuration | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.