Show HN: TypeQueue – A Generic SQS Wrapper for Go

1 points by kvizdos 8 hours ago

I've been working in Go for a while, and every time I needed to interact with AWS SQS, I found the experience straight up frustrating. There just wasn’t a good wrapper available that made sending and receiving messages, as well as testing that code, straightforward. So a few months ago I (slowly lol) started TypeQueue and pushed it to GitHub a few weeks back: https://github.com/kvizdos/typequeue.

TypeQueue is a generic (i think thats the right term..) wrapper for SQS that allows you to dispatch and consume messages in a type-safe way. It was built from the ground up with testing in mind. Unit testing SQS dependent code becomes super simple without needing to hit AWS, thanks to the mock implementations included. The package itself is fully unit tested AND I finally got to play with TestContainers (wow, they are really awesome), so it is also "integration" tested :D

One of my favorite parts is the new Batch Dispatcher. I really challenged myself to get it right: it’s designed to be safe for concurrent systems while keeping it intentionally limited. That was a bigger challenge than I thought heh. It's not meant to run in the background continuously: instead, it's built for when you KNOW you'll have a ton of messages to send at once (think like scheduled tasks dispatching messages). Once I finally got the concurrency management just right, I was super happy with the result (if any Go-pro's wanna take a look and provide feedback, definitely do! I'm not quite sure I understood sync pools right haha).

One other thing this fixes: lambda consumers. For whatever reason, lambda is (I think, please correct me!) the ONLY place where you need to “reject” messages instead of “acknowledge” (delete) messages. Just use the Consumer/LamdaConsumer, return an error, and the package will figure out what to do :)

I have future plans of possibly supporting different types of queues (e.g. RabbitMQ) and a "continuously batched" dispatcher, but not right now. PRs always welcome of course.

I'm really excited for Go folks to give it a shot and would love to hear any feedback you might have.

Even if you aren't a Go person.. if you haven't used TestContainers, check out the repo (maybe give it a star if you are feeling generous) and look into the test container stuff (test files w/ _integration in them). It's so cool what they can do! Question for the audience: call this “generic” or “type safe”? :)

thanks for your time