You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Justin Bertram (Jira)" <ji...@apache.org> on 2024/09/24 14:13:00 UTC

[jira] [Commented] (ARTEMIS-5064) Make last value key optional

    [ https://issues.apache.org/jira/browse/ARTEMIS-5064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17884295#comment-17884295 ] 

Justin Bertram commented on ARTEMIS-5064:
-----------------------------------------

So...any message sent to the queue would replace the existing message in the queue such that there is only ever one message in the queue (i.e. the "last" message)?

> Make last value key optional
> ----------------------------
>
>                 Key: ARTEMIS-5064
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5064
>             Project: ActiveMQ Artemis
>          Issue Type: Task
>            Reporter: Josh Byster
>            Priority: Minor
>
> Currently (although I may be misunderstanding intended behavior), one cannot have a last value queue configured without setting some form of a key. At least for OpenWire, I see that the following code in LastValueQueue always returns true, so values never get removed.
> Ideally, I can have a last value queue that just keeps the last value no matter what, i.e. I don't need a key to be set.
> Right now I'm working around this by setting the key to __HDR_DROPPABLE, which at least returns a property here that is the same for all of our messages (false), but this is very hacky and doesn't seem like I'm approaching this correctly.
> {code:java}
>    private boolean currentLastValue(final MessageReference ref) {
>       boolean currentLastValue = false;
>       SimpleString lastValueProp = ref.getLastValueProperty();
>       if (lastValueProp != null) {
>          MessageReference current = map.get(lastValueProp);
>          if (current == ref) {
>             currentLastValue = true;
>          }
>       } else {
>          // if the ref has no last value
>          return true;
>       }
>       return currentLastValue;
>    }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@activemq.apache.org
For additional commands, e-mail: issues-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact