To set an “ordering key” on a message sent to Google Pub/Sub via Spring Boot using “Spring Integration”, you need to do the following: (1) Set the publisher as supporting ordering. Add the following to your application.yaml: spring: cloud: gcp: pubsub: publisher: enable-message-ordering: true (2) Set the ordering key on the message you’re sending: var message = MessageBuilder .withPayload(request) .setHeaderIfAbsent(GcpPubSubHeaders.ORDERING_KEY, "my key") .build(); This works on Spring Boot 2. Read more...
I blog about my experiences working as a developer, architect. Originally from the UK, currently in Vienna.
These days I mainly work on web software and REST services using Java, Spring, PostgreSQL, AWS and React.
— Adrian Smith