Skip to content

Performance regression when using Hibernate with reactive message queues #45792

Answered by cescoffier
LarsSven asked this question in Q&A
Discussion options

You must be logged in to vote

Try with:

@Path("/")
public class ResourceSendingToKafka {

    @Channel("kafka") MutinyEmitter<Fruit> emitter;

    @POST
    @Path("/fruits")
    @Transactional                                                      
    public void storeAndSendToKafka(Fruit fruit) {     
        fruit.persist();
        return emitter.sendAndAwait(new FruitDto(fruit));                       
    }
}

Or, if you don't care about the Kafka emission (and don't want to wait for the ack from the broker) you can either:

  • Set Kafka ack to 0
  • Or use:
@Path("/")
public class ResourceSendingToKafka {

    @Channel("kafka") MutinyEmitter<Fruit> emitter;

    @POST
    @Path("/fruits")
    @Transactional

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@LarsSven
Comment options

@cescoffier
Comment options

Answer selected by LarsSven
@LarsSven
Comment options

@cescoffier
Comment options

@ozangunalp
Comment options

@LarsSven
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants