If Map. If Map.has_key?(messages_by_type, "type_a") do Messages_by_type = messages |> oup_by(įn m -> m.ssage_attributes.value end, I guess I could use one batcher, split up messages in the single handle_batch callback, and process my different “type” messages in that same callback… Something like def handle_message(_, message, _) do Perhaps this is not possible with Broadway, or I should be using a different pattern?ĭo I need to create my own GenStage producer implementation? To do this, we'll need to create an instance of CreateQueueRequest: CreateQueueRequest createStandardQueueRequest new CreateQueueRequest ( 'baeldung-queue' ) String standardQueueUrl sqs.createQueue (createStandardQueueRequest).getQueueUrl () 3.2. Is there a way that I can force my handle_batch callbacks fire in the order I would want, ensuring that message batches are processed based on the order of messages in my queue? Let's see how we can create a Standard Queue. This creates a problem since the first message put in my FIFO queue (message type_a) is actually being processed after the second message (message type_b). However, in this example, my handle_batch callback is firing in the following order: The IO.puts statement from each handle_message callback prints messages in this order in my console. ![]() Messages are being received in an expected order. I put messages into one of three batches (one batch per each type) def handle_message(_, % = message, _) do I have a handle_message callback for each message “type”. Using a FIFO queue since it is important that messages are processed in order, despite their types.Īll messages have the same Message Group Id to ensure they are processed in order within my FIFO queue. ![]() ![]() When the message is added to the queue, I am adding a custom message attribute “type” which is a string representing one of the above types. I am currently building a Broadway pipeline using Broadway SQS (BroadwaySQS.Producer) and an SQS FIFO queue.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |