javaazureservicebus

Sending Session-Enabled messages to Premium-Tier Service Bus doesn't work


I'm using com.azure.spring:spring-cloud-azure-starter-servicebus-jms:4.7.0 to send messages to queues in Azure Service Bus, using the Spring JmsTemplate, Spring Boot version 2.6.8. As discussed here you need to set the JMSXGroupID property on the message, in order to send it to a queue that has sessions enabled.

I do exactly that and when I send the message to a queue in a standard-tier Service Bus it works just fine.

When the same code is used to send requests to a premium-tier Service Bus, I get the following error message:

Caused by: org.apache.qpid.jms.provider.ProviderException: The SessionId was not set on a message, and it cannot be sent to the entity. Entities that have session support enabled can only receive messages that have the SessionId set to a valid value. Reference:b555fb0f-abef-4c8e-a1e3-16f3040ef2a0, TrackingId:ae38db690000043a00056bc2647dfc26_G5S1_B22S1, SystemTracker:queuenamehere, Timestamp:2023-06-05T15:15:50 [condition = amqp:not-allowed] at org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToNonFatalException(AmqpSupport.java:181) ~[qpid-jms-client-0.53.0.jar:na] at org.apache.qpid.jms.provider.amqp.AmqpFixedProducer.applyDeliveryStateUpdate(AmqpFixedProducer.java:252) ~[qpid-jms-client-0.53.0.jar:na] at org.apache.qpid.jms.provider.amqp.AmqpFixedProducer.processDeliveryUpdates(AmqpFixedProducer.java:223) ~[qpid-jms-client-0.53.0.jar:na]

The queues and the Service Bus resources are created via a terraform script, to make sure everything is exactly the same.

What I would expect is my app to be able to send messages to a session-enabled queue on a premium-tier Service Bus. I also did some debugging and made sure that the property is actually set on the outgoing message.

I have a message producer bean which has the following method (the jmsTemplate is autowired):

private void sendMessageToQueue(Queue queue, Object payload, boolean setGroupId)
{
    jmsTemplate.convertAndSend(queue, payload, (Message message) ->
    {
        if (setGroupId)
        {
            setGroupId(message);
        }
        return message;
    });
}

The setGroupId method looks as follows:

void setGroupId(Message message)
{
    try
    {
        message.setStringProperty("JMSXGroupID","0");
    }
    catch (JMSException e)
    {
        LOG.error("Setting of JMSXGroupID failed with exception: {}", e.getMessage());
    }
}

Solution

  • It's an issue with the SDK. Setting the pricing-tier parameter in the yml file to 'standard' instead of 'premium' "fixed" the issue.