Solace Community is getting a facelift!

On March 3rd we will be starting the process of migrating Solace Community to a new platform. As a result, Solace Community will go in to a temporary read-only state. You will still be able to come onto Solace Community and search through posts to find answers, but you won't be able to ask questions, post comments, or react in any way.

We hope to have the migration complete by Wednesday March 5th (or sooner), so please keep an eye out!

Cache request on python

Member Posts: 7

I found that solace PubSub+ 1.6.0 support cache
Site faviconFeature Support in PubSub+ Messaging APIs

But I follow this Site faviconUsing PubSub+ Cache With the Python API

step to do cache request

I can not receive the cache message from direct_receiver.receive_async(MessageHandlerExample())
but I can use DirectMessageReceiver.add_subscription to get message(CacheStatus.LIVE).

and I also develope C# code it allowed call SendCacheRequest to receive cacehe message.

any one use python to call cache successlly?

Thanks

Best Answer

Answers

  • Member, Administrator, Moderator, Employee Posts: 973 admin
    #3 Answer ✓

    Hi @Chris,

    We actually just added a sample in solace-samples-python to use PS+ Cache a few days ago. Can you take a look and see if this helps you out!

    https://github.com/SolaceSamples/solace-samples-python/blob/main/howtos/how_to_request_cached_data.py

  • Member Posts: 7

    Hi Marc,

    I do try that how_to_request_cached_data.py but it still can't receive cache data.

    what detail settings should I check out?

    my python code flow is
    1.MessagingService.connect()
    2.message_receiver = MessagingService.create_direct_message_receiver_builder().build()

    3.message_receiver.start()

    4.message_receiver.receive_async(MyMessageHandler())
    call cache request
    5.HowToUseCachedMessageSubscriptionRequests().create_subscription_request_to_receive_latest_message(message_receiver , "subexpress", "cache name", 3000)
    or create_subscription_request_to_receive_cached_and_live_messages,

    or create_cached_subscription_with_more_options,

    or create_subscription_to_receiver_only_cached_messages,

    6.do another message_receiver.add_subscription

    is it correct?

  • Member, Administrator, Moderator, Employee Posts: 973 admin

This Month's Leaders

This Week's Leaders