-
Notifications
You must be signed in to change notification settings - Fork 626
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
DefaultMessagePropertiesConverter#toMessageProperties should handle x-delay in Short #2667
Comments
The We probably can go ahead and try to resolve any What RabbitMQ broker version do you use? |
I understand the where -5000 is from on the queue, but it looks like when client retrieves it, it provides back a positive number, I am not sure how the spec says about this behavior. `
t 0x74
|
Yeah... I'm not very good in parsing HEX, but if whatever I suggested before about Thanks |
That would be great, thanks. |
Fixes: #2667 The `x-delay` header may arrive as a `Short` from RabbitMQ broker. * Fix `DefaultMessagePropertiesConverter.toMessageProperties()` to deal with a `Number` to extract `long` value from the `x-delay` header # Conflicts: # spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/DefaultMessagePropertiesConverter.java
Related to #2667 The `DefaultMessagePropertiesConverter.toMessageProperties()` may receive an `x-delay` header as negative value. **Auto-cherry-pick to `3.0.x`**
Related to #2667 The `DefaultMessagePropertiesConverter.toMessageProperties()` may receive an `x-delay` header as negative value. # Conflicts: # spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/DefaultMessagePropertiesConverter.java
In what version(s) of Spring AMQP are you seeing this issue?
3.0.4
Describe the bug
When sending a message via delayed-message-exchange, and get the message via amqpTemplate, we get a null receivedDelay
To Reproduce
Send a message via delayed-message-exchange, with a delay of 5 seconds. The message will show up with x-delay of -5000 in the queue:
When using amqpTemplate to receive the message, it reaches DefaultMessagePropertiesConverter#toMessageProperties, the header value shows up as type Short:
Therefore the message will show up with receivedDelay as null.
While we are at it, we should also ensure receivedDelay is a positive number here, therefore a Math.abs() should help.
I did observe negative receivedDelay, but have not been able to reproduce it yet.
Expected behavior
The message should show up with receivedDelay as 5000
Sample
@SpringBootApplication
public class RabbitTestApplication implements CommandLineRunner {
@Autowired
private AmqpTemplate amqpTemplate;
}
The text was updated successfully, but these errors were encountered: