Last Value Queues

petegehrman
petegehrman Member Posts: 43 ✭✭

Does a Last Value Queue store only a single message, or a single message per unique topic? What are some common use cases for them?

Tagged:

Comments

  • nram
    nram Member, Employee Posts: 80 Solace Employee
    edited January 2021 #2

    Hi @petegehrman , Last value queue (LVQ) can subscribe to multiple topics, or use wild card topic subscription, but the last message published across all the subscribed topics will be stored on the LVQ. It does not store last messages published per unique topic. For eg., if LVQ has "test/>" as topic subscription and message1 is published on test/1 and message2 on test/2, then only message2 will be retained. To retain last message published on different topics, multiple LVQs with different subscription on each can be provisioned. Alternatively, you can use PubSub+ Cache (https://docs.solace.com/Solace-PubSub-Cache/PubSub-Cache-Overview.htm)
    Primary use case for LVQ is for publishers to know where to resume publishing from. This is especially useful after they recover from an unexpected crash/restart.

  • petegehrman
    petegehrman Member Posts: 43 ✭✭

    Thanks for the information @nram

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

    Hey Pete! Are you German?? Anyhow, to expand on what Ramesh said, LVQs are often used to assist Guaranteed publishers in a crash/restart process. If a publisher crashes and completely loses state, when it reconnects to Solace it can query the LVQ to find out what was the last message the broker received. This is versus something like a network disconnect or broker restart where the publisher/API doesn't lose state and so it knows which message was last sent. Anyhow, in this scenario, one of the levels of the topic hierarchy would be a unique publisher ID... so like: [app]/[region]/[type]/[pubID]/[obj] (or something!). So then each publisher would have its own LVQ, and it would subscribe to */*/*/01234/> for that specific publisher, so the LVQ would always contain the last message received that matched that specific topic with that specific pubID.

    I hope that makes sense..!

    Otherwise, I've heard of other customers using it more like a "start of day" cache, or something to hold a bunch of reference information. The PubSub+ Cache @nram mentions is a last-value-cache per-topic, but can store millions of topics (vs. a LVQ). But the LVQ can store a single large message that could contain lots of reference data..? However you want to use it.

    Anyhow, hope that helps!

    aa

  • petegehrman
    petegehrman Member Posts: 43 ✭✭

    Thanks Aaron, I do have German roots :) I appreciate the explanation on this. I am new to PubSub+ and am trying to learn as much as possible about the feature set as we're getting ready to use it in our organization.