🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Golang Parallel For One Consumer?

klauszi
klauszi Member Posts: 3

How can I increase the number of connections for a consumer using pubsubplus-go-client? We pass a callback to ReceiveAsync for a consumer via PersistentMessageReceiver, but only one message is processed at a time.

Answers

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 644 admin

    I don't know Go, but this sounds like a threading issue. The API only has one thread to dispatch the messages to you. If I wanted to build a parallel-processing consumer in Java, I would receive the message via Async, and then place it onto an in-memory Queue/List for processing, and let the callback return right away. Then I'd have 3, 5, 10 threads that I've started trying to pull of that in-memory queue, processing the messages, and the ACKing the message once complete. I made a video about this. (just think of Persistent messages + ACKing instead of request/reply).

    Or, do it the microservice way and just have many instances of your app running?