Cheap message deduplication IDs generator?

Hello fellow Gophers,

This is a code snippet from the official AWS documentation:

private static AmazonSNS snsClient;
private static final String MESSAGE_PAYLOAD = " - - [28/Oct/2021:10:27:10 -0500] "GET /index.html HTTP/1.1" 200 3395";
private static final String MESSAGE_FIFO_GROUP = "server1234";

PublishRequest request = new PublishRequest()
PublishResult response = snsClient.publish(request);

Notice how expensively it creates a new message deduplication ID: it literally creates a new UUID and uses that.

I wonder, do you have any cheaper ways for creating deduplication IDs ?

Maybe you can find something here atomic package - sync/atomic -

To easily generate unique IDs in Go, I use this very useful package:

If you need something orderable, maybe take a look into this snowflake ID implementation.

I hope this was somewhat helpful to you. :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.