clebertsuconic commented on a change in pull request #3450:
URL: https://github.com/apache/activemq-artemis/pull/3450#discussion_r574846749
##########
File path:
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/coreWrapper/CoreMessageWrapper.java
##########
@@ -137,247 +175,187 @@ public final String getJMSCorrelationID() throws
JMSException {
}
}
- @Override
- public final void setJMSCorrelationID(String correlationID) throws
JMSException {
+ public final void setJMSCorrelationID(String correlationID) {
message.setCorrelationID(correlationID);
}
- @Override
- public final Destination getJMSReplyTo() throws JMSException {
- SimpleString reply = MessageUtil.getJMSReplyTo(message);
- if (reply != null) {
- return ActiveMQDestination.fromPrefixedName(reply.toString());
- } else {
- return null;
- }
+ public final SimpleString getJMSReplyTo() {
+ return MessageUtil.getJMSReplyTo(message);
}
- @Override
- public final void setJMSReplyTo(Destination replyTo) throws JMSException {
- MessageUtil.setJMSReplyTo(message, replyTo == null ? null :
((ActiveMQDestination) replyTo).getSimpleAddress());
+ public final void setJMSReplyTo(String replyTo) {
+ MessageUtil.setJMSReplyTo(message, SimpleString.toSimpleString(replyTo));
}
- @Override
- public Destination getJMSDestination() throws JMSException {
- return ActiveMQDestination.createDestination(message.getRoutingType(),
message.getAddressSimpleString());
- }
-
- @Override
- public final void setJMSDestination(Destination destination) throws
JMSException {
- if (destination == null) {
- message.setAddress((SimpleString) null);
- } else {
- message.setAddress(((ActiveMQDestination)
destination).getSimpleAddress());
+ public SimpleString getDestination() {
+ if (message.getAddress() == null || message.getAddress().isEmpty()) {
+ return null;
}
-
+ return
SimpleString.toSimpleString(AMQPMessageSupport.destination(message.getRoutingType(),
message.getAddress()));
}
- @Override
- public final int getJMSDeliveryMode() throws JMSException {
- return message.isDurable() ? DeliveryMode.PERSISTENT :
DeliveryMode.NON_PERSISTENT;
+ public final void setDestination(String destination) {
+ message.setAddress(destination);
}
- @Override
- public final void setJMSDeliveryMode(int deliveryMode) throws JMSException {
- if (deliveryMode == DeliveryMode.PERSISTENT) {
- message.setDurable(true);
- } else if (deliveryMode == DeliveryMode.NON_PERSISTENT) {
- message.setDurable(false);
- } else {
- throw new JMSException("Invalid mode " + deliveryMode);
- }
+ public final int getJMSDeliveryMode() {
+ return message.isDurable() ? PERSISTENT : NON_PERSISTENT;
}
- @Override
- public final boolean getJMSRedelivered() throws JMSException {
- return false;
+ public final void setDeliveryMode(int deliveryMode) throws
ConversionException {
+ switch (deliveryMode) {
+ case PERSISTENT:
+ message.setDurable(true);
+ break;
+ case NON_PERSISTENT:
+ message.setDurable(false);
+ break;
+ default:
+ // There shouldn't be any other values used
+ throw new ConversionException("Invalid mode " + deliveryMode);
+ }
}
- @Override
- public final void setJMSRedelivered(boolean redelivered) throws
JMSException {
- // no op
- }
- @Override
- public final String getJMSType() throws JMSException {
+ public final String getJMSType() {
return MessageUtil.getJMSType(message);
}
- @Override
- public final void setJMSType(String type) throws JMSException {
+ public final void setJMSType(String type) {
MessageUtil.setJMSType(message, type);
}
- @Override
- public final long getJMSExpiration() throws JMSException {
+ public final long getExpiration() {
return message.getExpiration();
}
- @Override
- public final void setJMSExpiration(long expiration) throws JMSException {
+ public final void setJMSExpiration(long expiration) {
message.setExpiration(expiration);
}
- @Override
- public final long getJMSDeliveryTime() throws JMSException {
Review comment:
This is handled by the converter directly. The "JMS" facade was not
using it in any way.
There are open wire scheduled delivery tests for this already.
On AMQP to Core Converter:
https://github.com/apache/activemq-artemis/blob/master/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AmqpCoreConverter.java#L279-L300
On Core to AMQP Converter, the Converter will remove the Scheduled Delivery
on Purpose, as part of:
https://github.com/apache/activemq-artemis/blob/master/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java#L300-L302
The only reason Actually AMQP To Core converter is treating scheduling is
because we used to always convert to Core. On the recent versions of the broker
the message will stay on its original format until the actuall delivery
occurred.
If there is a bug it would not been cause by this change anyways but I think
we are safe here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]