Skip to content

Instantly share code, notes, and snippets.

@mmornati
Last active December 8, 2019 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmornati/3b133fa3ebac67548e58df98cefc246e to your computer and use it in GitHub Desktop.
Save mmornati/3b133fa3ebac67548e58df98cefc246e to your computer and use it in GitHub Desktop.
Consume Operation Message
@Component
@RequiredArgsConstructor
public class OperationMessageConsumer {
private static final LoggerService LOGGER = LoggerServiceFactory.getLoggerService(OperationMessageConsumer.class);
private final MyExternalService service;
private static final ObjectMapper MAPPER = new ObjectMapper();
@RabbitListener(id = LISTENER_ID, queues = Queues.OPERATIONS, containerFactory = "rabbitListener")
public void handlePspCallMessage(Message message) throws IOException {
OperationMessage operationMessage = MAPPER.readerFor(OperationMessage.class).read(message.getBody());
service.doWhatYouNeed(operationMessage);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment