-
-
Save tacsio/036a0fb0e8181b3a634221be460d21b4 to your computer and use it in GitHub Desktop.
Sample Listener if you don't have __TypeID__ but have other header (for example : type)
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
public class ListenerSample { | |
// Adjust the header name if required, on @Header parameter | |
@RabbitListener(queues = "q.finance.invoice") | |
public void listenInvoiceCreated(@Payload String message, @Header(AmqpHeaders.DELIVERY_TAG) long tag, | |
@Header("type") String type) throws IOException { | |
if (StringUtils.equalsIgnoreCase(type, "invoice.paid")) { | |
log.info("Delegate to invoice paid handler"); | |
} else if (StringUtils.equalsIgnoreCase(type, "invoice.created")) { | |
log.info("Delegate to invoice created handler"); | |
} else { | |
log.info("Delegate to default handler"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment