Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shall SpringAMQPHeader read receivedDeliveryMode instead of deliveryMode? #74

Open
apim opened this issue Jan 9, 2020 · 0 comments
Open

Comments

@apim
Copy link

apim commented Jan 9, 2020

Hi

The method setBasicPropertiesToHeaders in class SpringAMQPHeader reads the deliveryMode property while consuming a message. Shall this instead read receivedDeliveryMode property?

Through wireshark and spring-amqp logging I can see if a producer sends different values for delivery-mode (PERSISTENT / NON_PERSISTENT), they get deserialised in receivedDeliveryMode property. Hence the above class fails in NPE while reading from a queue.

In addition, below snippet from Spring Rabbit jar (class DefaultMessagePropertiesConverter) gives me impression that while reading a message it would set the receivedDeliveryMode field only while setting deliveryMode to null always.

Integer deliveryMode = source.getDeliveryMode();
if (deliveryMode != null) {
	target.setReceivedDeliveryMode(MessageDeliveryMode.fromInt(deliveryMode));
}
target.setDeliveryMode(null);

Am I missing something here? My present code, when switched from 1.6.3 of this repo to 1.7.0, fails with NPE with below stacktrace

Caused by: java.lang.NullPointerException: null
	at org.springframework.amqp.core.MessageDeliveryMode.toInt(MessageDeliveryMode.java:34)
	at amqp.spring.camel.component.SpringAMQPHeader.setBasicPropertiesToHeaders(SpringAMQPHeader.java:69)
	at amqp.spring.camel.component.SpringAMQPMessage.fromAMQPMessage(SpringAMQPMessage.java:53)
	at amqp.spring.camel.component.SpringAMQPConsumer$RabbitMQMessageListener.onMessage(SpringAMQPConsumer.java:197)
	at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:856)

Any suggestion please?

Cheers
Mainak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant