Python - Additional properties for with_missing_resources_creation_strategy()

ManuManu Member Posts: 8
edited September 2021 in PubSub+ Event Broker #1


As a python subscriber to an external broker, we are only limited to create Durable Exclusive queue via SMF Api.
Since there's an existing method prior to starting the receiver, with_missing_resources_creation_strategy(), by default its endpoint created on a permission for that queue is Delete. However, it is required for us to use None permission.

This is the sample of override queue permission prior to creation in python

def create_missing_queue(messaging_service: MessagingService, queue: Queue):
receiver = messaging_service.create_persistent_message_receiver_builder() \
.with_missing_resources_creation_strategy(MissingResourcesCreationStrategy(1)) \
receiver._end_point_props = {**receiver._end_point_props, **end_point_props}
return receiver

What are the other properties via python SMF for Message Expiry Maximum TTL and Message Expiry Maximum Redelivery count?


  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 491 admin
    edited September 2021 #2

    Hey @ManuManu! You can definitely do this leveraging queue templates and Queue Name Filter, and basically pass a queue name that matches the filter you defined. You can create a queue template in 3 ways:
    1. PubSub+ Broker management console
    2. CLI
    3. SEMP

    From the web UI mgmt console, you can do so by navigating to the queues tab and under templates create a template

    And then specify the queue filter name

    From here you can specify the queue properties (including the the setting of permissions to None and other properties).

    Note: you can also do that via CLI and one SEMP REST API call for configuration of the templates

    You can read more about configuring queue templates here: Configuring Queue Templates

    After you have created the template and the name filter, you can pass that from your Python api as follows

    receiver = messaging_service.create_persistent_message_receiver_builder() \
    .with_missing_resources_creation_strategy(MissingResourcesCreationStrategy(1)) \

    When doing so, if the queue created matches the name filter it will have the properties you specified in the template

    The trick is to choose a name filter that will match your use case. Let me know if that works with you and if you have any other followup questions

  • ManuManu
    ManuManu Member Posts: 8

    Hi @Tamimi, The 3 options would not work for us as our external client only allow us to use SMF port 55443. We will try to work with the external client if it's possible for them to configure a queue template on behalf of us.

    Although a bit hacky but this one works using SMF when we tested it. What we are just missing is the property for Message Expiry Maximum TTL.

    The code below:

    • sets the permission for the queue to None. Only us can have control of the queue
    • enables the respect message ttl option
    • sets the max message redelivery to 10
    • tested on local dockerized pubsubplus
    • tested on free trial cloud pubsublus
    # other imports
    from solace.messaging.config._sol_constants import SOLCLIENT_ENDPOINT_PROP_PERMISSION, \
    def create_missing_queue(messaging_service: MessagingService, queue: Queue):
        # solace-pubsubplus version is 1.1.0
        end_point_props = { 
            'ENDPOINT_RESPECTS_MSG_TTL': '1'
        receiver = messaging_service.create_persistent_message_receiver_builder() \
        .with_missing_resources_creation_strategy(MissingResourcesCreationStrategy(1)) \
        receiver._end_point_props = {**receiver._end_point_props, **end_point_props}
        return receiver

    Is it possible to include it in the python roadmap the ability to include extra properties using with_messing_resources_creation_strategy() ?
    I think it would be great for subscribers have ability to add extra properties, with limitations, on creating a new queue especially when a subscriber is only allowed SMF.

  • amackenzie
    amackenzie Member, Employee Posts: 260 Solace Employee

    @ManuManu the missing resource strategy is a design principle of our new batch of APIs with Python being the start. A new Java API is due any minute now, and we have also added durable endpoint creation in JS/Node due out end of Oct.

    As the missing resource design is not an admin-centric "provisioning" API but more of a convenience to devs who only have access to SMF APIs not SEMP or Manager GUI, we have still allowed admins to control, to an extent, what the limits/parameters are included in the queues that the APIs can create. This is why anything non-default is controlled by templates.

    The idea is that when a broker admin sets up client usernames/profiles/ACLs for an application/set of applications (which is only available to admins), when they grant the ability to have the Apps create durable endpoints (and typically we see this in dev/test but rarely in production), they would also create queue template(s) that the Apps use when creating their durable endpoints. Creating a durable endpoint like a queue takes up physical resources on a broker and the admin will want to balance the convenience of allowing their App devs to create them on the fly vs. managing the resources across the message VPN for everyone.

    So we really see the pattern of creating queue templates as part of the client App onboarding and are unlikely to expand the APIs to do more of this.