Hello, I am a new for a RabbitMq and bumped into a problem.
I want to publish a message to MQ constructed form an Object defined from a class:
private String eventType;
private String values;
}
String eventType - I use it to carry a "Routing key".
String values - is presented by a JSON and is used for the Body of the message.
Hence DataEvent.getEventType="financial.billing".
- A payload (Body) should be Deserialized for Subscriber in the Class:
class DocumentReadyEvent {
private String transactionId;
private List<String> uris;
- Hence, I am trying to produce a "String values" in the JSON format as
{
"transactionId": "string",
"uris": [
"string"
]
}
- Subscriber configured as :
@RabbitListener(
autoStartup = "true",
bindings = {
@QueueBinding(
value = @Queue(
value = "${billing.queueName}",
autoDelete = "false",
durable = "true",
arguments = {
@Argument(name = "x-dead-letter-exchange"),
@Argument(name = "x-dead-letter-routing-key", value = "${billing.dlq.queueName}")
}
),
exchange = @Exchange(
type = ExchangeTypes.TOPIC
),
key = "${billing.exchangeKey}"
)
})
- This is an Example of the "message" I send:
Body - a Json String.. I expect that RabbitMQ will Serialize it
Body:'"{\"transactionId\":\"e4a6415d-a4d9-4b0d-94cc-7e609ac9fe80\", \"uris\":[\"/POLICY/1.xml\",\"/POLICY/2.xml\"]}"'
I expect that RabbitMQ desereialize it for Subscriber and Subscriber will have an Object:
class DocumentReadyEvent {
private String transactionId = "e4a6415d-a4d9-4b0d-94cc-7e609ac9fe80";
private List<String> uris = ArrayList <String> ("/POLICY/1.xml", "/POLICY/2.xml")
- However, all my Publish attempts result in message being "rejected" .
All messages rerouted to a "billingDocumentDlqQueue " , which is clear to me b/c it is configured as @Argument(name = "x-dead-letter-routing-key", value = "${billing.dlq.queueName}")
- Biggest question for me is How to find a reason for Message to be "rejected"?
My guess is, that somewhere an "MQ" log produces a detailed Message for rejection or
perhaps an Exception stacktrace. Can I find such log file somewhere? I am running a RabbitMQ on my local machine.
- This is an example of.message I am sending to RabbitMQ.
(
Body:'"{\"transactionId\":\"e4a6415d-a4d9-4b0d-94cc-7e609ac9fe80\", \"uris\":[\"/POLICY/OW-PAS/1010057/274558.xml\",\"/POLICY/OW-PAS/1010057/274558.xml\"]}"'
MessageProperties
[
headers={__TypeId__=java.lang.String},
contentType=application/json,
contentEncoding=UTF-8,
contentLength=150,
deliveryMode=PERSISTENT,
priority=0,
deliveryTag=0
]
)
Routing Key billingDocumentDlqQueue
__TypeId__: java.lang.String
exchange: documentEventExchange
queue: billingDocumentEventQueue
routing-keys: financial.billing
x-first-death-exchange: documentEventExchange
x-first-death-queue: billingDocumentEventQueue
x-first-death-reason: rejected
content_type: application/json
"{\"transactionId\":\"e4a6415d-a4d9-4b0d-94cc-7e609ac9fe80\", \"uris\":[\"/POLICY/OW-PAS/1010057/274558.xml\",\"/POLICY/OW-PAS/1010057/274558.xml\"]}"
I'll very appreciate any suggestions.