[
https://issues.apache.org/jira/browse/ARTEMIS-2639?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ansgar J. Sachs updated ARTEMIS-2639:
-------------------------------------
Description:
{quote}As developer, I expect proper ActiveMQ Notifications, when consuming
only some of them{quote}
h3. Steps to reproduce
1a) Create a broker and add the following:
{code:java}
<divert name="consumer-notification-divert">
<address>activemq.notifications</address>
<forwarding-address>jms.consumer.notifications</forwarding-address>
<filter string="_AMQ_NotifType = 'CONSUMER_CREATED' OR _AMQ_NotifType =
'CONSUMER_CLOSED'"/>
</divert>
{code}
1b) Same situation for:
{code:java}
<addresses xmlns="urn:activemq:core">
<address name="activemq.notifications">
<anycast>
<queue name="jms.consumer.notifications">
<durable>true</durable>
<filter string="_AMQ_NotifType = 'CONSUMER_CREATED' OR
_AMQ_NotifType = 'CONSUMER_CLOSED'"/>
</queue>
</anycast>
</address>
</addresses>
{code}
2) Consume those messages with a MDB
{code:java}
@MessageDriven(
name = "Notification_Subber",
activationConfig = {
@ActivationConfigProperty(propertyName = "destination",
propertyValue = "jms.consumer.notifications"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "useJndi",
propertyValue = "false"),
}
)
public class NotificationMDB implements MessageListener {
public void onMessage(Message message) {
// Log message here
// The message is missing all properties as documented in
https://activemq.apache.org/components/artemis/documentation/latest/management.html
}
}
{code}
h3. Expected Behavior
I would expect the same messages that are consumed as follows:
{code:java}
@MessageDriven(
name = "Notification_Subber",
activationConfig = {
@ActivationConfigProperty(propertyName = "destination",
propertyValue = "activemq.notifications"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "useJndi",
propertyValue = "false"),
@ActivationConfigProperty(propertyName =
"messageSelector",propertyValue = "_AMQ_NotifType = 'CONSUMER_CREATED' OR
_AMQ_NotifType = 'CONSUMER_CLOSED'"
}
)
public class NotificationMDB implements MessageListener {
public void onMessage(Message message) {
// Log message here
// This one actually returns all properties
}
}
{code}
h3. Current behavior
I guess that the filter includes some kind of message-copy workflow which
removes all those properties?
During this copy process, all properties starting with "_" will be deleted.
h3. Workaround
Right now, the only workaround for this issue is a custom transformer, which
does the following:
{code:java}
public class NotificationsTransformer implements Transformer {
private static final Logger log =
Logger.getLogger(NotificationsTransformer.class.getName());
public Message transform(Message message) {
try {
log.finest(String.format("Transform CoreMessage: %s",
message.toString()));
message.putStringProperty("event_timestamp",
message.getStringProperty("_AMQ_NotifTimestamp"));
message.putStringProperty("address_name",
message.getStringProperty("_AMQ_Address"));
message.putStringProperty("event_type",
message.getStringProperty("_AMQ_NotifType"));
message.putStringProperty("queue_name",
message.getStringProperty("_AMQ_RoutingName"));
} catch (Exception e) {
log.warning(String.format("Failed to transform message: %s",
e.getMessage()));
}
return message;
}
}
{code}
h3. Steps to achieve victory
(/) Find the errorneous message copy
(/) Forward all message properties
was:
{quote}As developer, I expect proper ActiveMQ Notifications, when consuming
only some of them{quote}
h3. Steps to reproduce
1a) Create a broker and add the following:
{code:java}
<divert name="consumer-notification-divert">
<address>activemq.notifications</address>
<forwarding-address>jms.consumer.notifications</forwarding-address>
<filter string="_AMQ_NotifType = 'CONSUMER_CREATED' OR _AMQ_NotifType =
'CONSUMER_CLOSED'"/>
</divert>
{code}
1b) Same situation for:
{code:java}
<addresses xmlns="urn:activemq:core">
<address name="activemq.notifications">
<anycast>
<queue name="jms.consumer.notifications">
<durable>true</durable>
<filter string="_AMQ_NotifType = 'CONSUMER_CREATED' OR
_AMQ_NotifType = 'CONSUMER_CLOSED'"/>
</queue>
</anycast>
</address>
</addresses>
{code}
2) Consume those messages with a MDB
{code:java}
@MessageDriven(
name = "Notification_Subber",
activationConfig = {
@ActivationConfigProperty(propertyName = "destination",
propertyValue = "jms.consumer.notifications"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "useJndi",
propertyValue = "false"),
}
)
public class NotificationMDB implements MessageListener {
public void onMessage(Message message) {
// Log message here
// The message is missing all properties as documented in
https://activemq.apache.org/components/artemis/documentation/latest/management.html
}
}
{code}
h3. Expected Behavior
I would expect the same messages that are consumed as follows:
{code:java}
@MessageDriven(
name = "Notification_Subber",
activationConfig = {
@ActivationConfigProperty(propertyName = "destination",
propertyValue = "activemq.notifications"),
@ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Topic"),
@ActivationConfigProperty(propertyName = "useJndi",
propertyValue = "false"),
@ActivationConfigProperty(propertyName =
"messageSelector",propertyValue = "_AMQ_NotifType = 'CONSUMER_CREATED' OR
_AMQ_NotifType = 'CONSUMER_CLOSED'"
}
)
public class NotificationMDB implements MessageListener {
public void onMessage(Message message) {
// Log message here
// This one actually returns all properties
}
}
{code}
h3. Current behavior
I guess that the filter includes some kind of message-copy workflow which
removes all those properties?
During this copy process, all properties starting with "_" will be deleted.
h3. Workaround
Right now, the only workaround for this issue is a custom transformer, which
does the following:
{code:java}
public class NotificationsTransformer implements Transformer {
private static final Logger log =
Logger.getLogger(NotificationsTransformer.class.getName());
public Message transform(Message message) {
try {
log.finest(String.format("Transform CoreMessage: %s",
message.toString()));
message.putStringProperty("event_timestamp",
message.getStringProperty("_AMQ_NotifTimestamp"));
message.putStringProperty("address_name",
message.getStringProperty("_AMQ_Address"));
message.putStringProperty("event_type",
message.getStringProperty("_AMQ_NotifType"));
message.putStringProperty("queue_name",
message.getStringProperty("_AMQ_RoutingName"));
} catch (Exception e) {
log.warning(String.format("Failed to transform message: %s",
e.getMessage()));
}
return message;
}
}
{code}
h3. Steps to achieve victory
(x) Find the errorneous message copy
(x) Forward all message properties
> Lost notification properties when using OpenWire client with a divert
> ----------------------------------------------------------------------
>
> Key: ARTEMIS-2639
> URL: https://issues.apache.org/jira/browse/ARTEMIS-2639
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: Broker, OpenWire
> Affects Versions: 2.11.0
> Reporter: Ansgar J. Sachs
> Priority: Major
> Fix For: 2.12.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> {quote}As developer, I expect proper ActiveMQ Notifications, when consuming
> only some of them{quote}
> h3. Steps to reproduce
> 1a) Create a broker and add the following:
> {code:java}
> <divert name="consumer-notification-divert">
> <address>activemq.notifications</address>
> <forwarding-address>jms.consumer.notifications</forwarding-address>
> <filter string="_AMQ_NotifType = 'CONSUMER_CREATED' OR _AMQ_NotifType
> = 'CONSUMER_CLOSED'"/>
> </divert>
> {code}
> 1b) Same situation for:
> {code:java}
> <addresses xmlns="urn:activemq:core">
> <address name="activemq.notifications">
> <anycast>
> <queue name="jms.consumer.notifications">
> <durable>true</durable>
> <filter string="_AMQ_NotifType = 'CONSUMER_CREATED' OR
> _AMQ_NotifType = 'CONSUMER_CLOSED'"/>
> </queue>
> </anycast>
> </address>
> </addresses>
> {code}
> 2) Consume those messages with a MDB
> {code:java}
> @MessageDriven(
> name = "Notification_Subber",
> activationConfig = {
> @ActivationConfigProperty(propertyName = "destination",
> propertyValue = "jms.consumer.notifications"),
> @ActivationConfigProperty(propertyName = "destinationType",
> propertyValue = "javax.jms.Topic"),
> @ActivationConfigProperty(propertyName = "useJndi",
> propertyValue = "false"),
> }
> )
> public class NotificationMDB implements MessageListener {
> public void onMessage(Message message) {
> // Log message here
> // The message is missing all properties as documented in
> https://activemq.apache.org/components/artemis/documentation/latest/management.html
> }
> }
> {code}
> h3. Expected Behavior
> I would expect the same messages that are consumed as follows:
> {code:java}
> @MessageDriven(
> name = "Notification_Subber",
> activationConfig = {
> @ActivationConfigProperty(propertyName = "destination",
> propertyValue = "activemq.notifications"),
> @ActivationConfigProperty(propertyName = "destinationType",
> propertyValue = "javax.jms.Topic"),
> @ActivationConfigProperty(propertyName = "useJndi",
> propertyValue = "false"),
> @ActivationConfigProperty(propertyName =
> "messageSelector",propertyValue = "_AMQ_NotifType = 'CONSUMER_CREATED' OR
> _AMQ_NotifType = 'CONSUMER_CLOSED'"
> }
> )
> public class NotificationMDB implements MessageListener {
> public void onMessage(Message message) {
> // Log message here
> // This one actually returns all properties
> }
> }
> {code}
> h3. Current behavior
> I guess that the filter includes some kind of message-copy workflow which
> removes all those properties?
> During this copy process, all properties starting with "_" will be deleted.
> h3. Workaround
> Right now, the only workaround for this issue is a custom transformer, which
> does the following:
> {code:java}
> public class NotificationsTransformer implements Transformer {
> private static final Logger log =
> Logger.getLogger(NotificationsTransformer.class.getName());
>
> public Message transform(Message message) {
> try {
> log.finest(String.format("Transform CoreMessage: %s",
> message.toString()));
> message.putStringProperty("event_timestamp",
> message.getStringProperty("_AMQ_NotifTimestamp"));
> message.putStringProperty("address_name",
> message.getStringProperty("_AMQ_Address"));
> message.putStringProperty("event_type",
> message.getStringProperty("_AMQ_NotifType"));
> message.putStringProperty("queue_name",
> message.getStringProperty("_AMQ_RoutingName"));
> } catch (Exception e) {
> log.warning(String.format("Failed to transform message: %s",
> e.getMessage()));
> }
> return message;
> }
> }
> {code}
> h3. Steps to achieve victory
> (/) Find the errorneous message copy
> (/) Forward all message properties
--
This message was sent by Atlassian Jira
(v8.3.4#803005)