Direct Message Behavior and Persistent Message Queue Configuration

Options
BrianChan
BrianChan Member Posts: 18
edited April 2022 in PubSub+ Event Broker #1

Hi all, I am currently exploring the solace message broker and come across two questions.

Question1:

I am trying to pass images with base64 encoded and direct PubSub is adopted. Since there are some program the subscriber has to run for each message and it takes time. Therefore, I expect there will be a latency for the subscriber to consume the message. I hope that the subscriber will always consume the newest message no matter there is some message it cannot deal with. Is it possible to configure like that? I am a python developer by the way.

I hear there is a term called 'Message Eliding' which I think is relevant. How to configure that in my python script?


Question2:

Another cases, I have four subscribers and I expect those subscribers only consume the message with a pre-defined message_id pattern. For example subscriberA would only consume the message with the id that give a remainder of 0 when divided by 4. In this case, should I make 4 topics and 4 queues? Is there any better solutions? I hear there is a term called 'partition'


I would be very grateful if someone can help me with these questions. Feel free to let me know if there is anything not clear. Thanks a lot.

Answers

  • RobO
    RobO Member, Employee Posts: 19 Solace Employee
    Options

    @BrianChan

    For Q1, look at Last Value Queue. Basically it will be a queue with a size of 1. The latest message to arrive will replace the previous one. Your consumer will always be processing the latest message then. If it takes time for the consumer to process, then messages on the queue will be replaced but there will only be the latest one.

    Q2: Partition queues is a feature that is currently not implemented but is on the product roadmap. If your topics are defined such that the messages are split appropriately, then topic to queue mapping is the way to go. If the message contains a property that you want to "filter" on, i.e. message_id is a user defined property, then message selectors could be used. A selector is a string that uses a conditional expression syntax that is a subset of SQL92. You can perform arithmetic expressions on numeric values, but I don't believe the 'mod' operator is supported. You can write a arithmetic expression that does the modulus calculation. For detailed information on message selector syntax, refer to the Java Message Service Specification – Version 1.1. Selectors are supported by all Solace messaging APIs.

  • BrianChan
    BrianChan Member Posts: 18
    Options

    Hi @RobO, actually I have tried the LVQ and the result was not what I expected. You may find my trial case details in this following post https://solace.community/discussion/1303/receive-the-latest-message-only-for-both-direct-message-and-persistent-message-python#latest

    If possible, please look into the issue for me. Thank you very much.