Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public ActiveMQMessageProducerSupport(ActiveMQSession session) {
*/
@Override
public void setDeliveryDelay(long deliveryDelay) throws JMSException {
throw new UnsupportedOperationException("setDeliveryDelay() is not supported");
if (deliveryDelay != 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference would be to leave the setter alone. I don't think we should allow using it as it's not supported, the getter can just return 0 for now, meaning there's just no delay.

throw new UnsupportedOperationException("setDeliveryDelay() is not supported");
}
}

/**
Expand All @@ -68,7 +70,7 @@ public void setDeliveryDelay(long deliveryDelay) throws JMSException {
*/
@Override
public long getDeliveryDelay() throws JMSException {
throw new UnsupportedOperationException("getDeliveryDelay() is not supported");
return 0L;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,16 @@ public long getTimeToLive() {

@Override
public JMSProducer setDeliveryDelay(long deliveryDelay) {
throw new UnsupportedOperationException("setDeliveryDelay(long) is not supported");
if (deliveryDelay != 0L) {
throw new UnsupportedOperationException("setDeliveryDelay(long) is not supported");
}

return this;
}

@Override
public long getDeliveryDelay() {
throw new UnsupportedOperationException("getDeliveryDelay() is not supported");
return 0L;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation looks off

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public void send(Destination destination, Message message, int deliveryMode, int
*/
@Override
public void setDeliveryDelay(long deliveryDelay) throws JMSException {
throw new UnsupportedOperationException("setDeliveryDelay() is not supported");
if (deliveryDelay != 0L) {
throw new UnsupportedOperationException("setDeliveryDelay() is not supported");
}
}

/**
Expand All @@ -156,7 +158,7 @@ public void setDeliveryDelay(long deliveryDelay) throws JMSException {
*/
@Override
public long getDeliveryDelay() throws JMSException {
throw new UnsupportedOperationException("getDeliveryDelay() is not supported");
return 0L;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ public void send(Destination destination, Message message, int deliveryMode, int
*/
@Override
public void setDeliveryDelay(long deliveryDelay) throws JMSException {
throw new UnsupportedOperationException("setDeliveryDelay() is not supported");
if (deliveryDelay != 0L) {
throw new UnsupportedOperationException("setDeliveryDelay() is not supported");
}
}

/**
Expand All @@ -218,6 +220,6 @@ public void setDeliveryDelay(long deliveryDelay) throws JMSException {
*/
@Override
public long getDeliveryDelay() throws JMSException {
throw new UnsupportedOperationException("getDeliveryDelay() is not supported");
return 0L;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,14 @@ public void testSessionSharedDurableConsumerSelector() throws JMSException {
session.createSharedDurableConsumer(session.createTopic("test"), null, null);
}

@Test(expected = UnsupportedOperationException.class)
@Test
public void testProducerDeliveryDelayGet() throws JMSException {
messageProducer.getDeliveryDelay();
assertEquals(0L, messageProducer.getDeliveryDelay());
}

@Test
public void testProducerDeliveryDelaySetZero() throws JMSException {
messageProducer.setDeliveryDelay(0L);
}

@Test(expected = UnsupportedOperationException.class)
Expand Down
Loading