Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
JmsTemplate batch issue

my current use case is in my listener it will:

  1. Consume an event(let's call it original event) from queue, this event includes list of replay events(let's call it sub events).
  2. Produce those replay events (sub events) in a batch to other queue.
  3. Update Cassandra.

I can produce all the replay events based on what Gary mention, and rollback all the replay events if any exceptions happen during produce.

Use one of the execute methods with a ProducerCallback...

SessionCallback and ProducerCallback

Then, in your ProducerCallback.doInJms() method...

Use the producer to send multiple messages. When the callback exits, the transaction will be committed.

However, if there are any exception happen in step 3 we can only rollback the original event but not those replay events, since in step 2 we already committed those replay events after the callback exits and those replay events already in another queue and cannot be rollback.

Does someone has any better idea about how we can rollback everything if step 3 has exception?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You have to do everything within the same session; consume, produce..., cassandra.

All inside doInJms()...

  • session.createConsumer()

try {

  • consumer.receive()
  • producer send() ...
  • cassandra update

finally {

  • consumer.close()

}

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda