Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMS message listener invoker failed, Cause: Identifier contains invalid JMS identifier character '-': 'x-request-id'

I'm working with JMS and queues (Azure queues) for the first time. I'm required to make a queue where Rubi server would write some data and Java would read it from queue and will do further executions. This process is working fine locally on my machine. I've created a REST endpoint which is writing data in the queue and once data is written in the queue, the listener would take over and read the data and execute. When we deploy it to Azure the error I can see in logs which is not letting the Queues start is

Setup of JMS message listener invoker failed for destination 'queue' - trying to recover. Cause: Identifier contains invalid JMS identifier character '-': 'x-request-id' 

Zipkin is also present on the Azure server as a distributed tracing system and I guess this x-request-id is related to Zipkin which is creating the problem. I've searched Google for the issue but couldn't understand why its happening.

Following is detailed error message:

[36mc.m.s.l.NextGenRequestLoggingFilter     [0;39m [2m:[0;39m 
Before request [uri=/services/deal-service/api/v2/deals/ack;headers= 
[x-request-id:"2d8d86d7-4fbf-9db6-8e95-28813f21a85c", 
x-envoy-internal:"true", x-b3-parentspanid:"a209cdc649b0b890", content- 
length:"575", x-forwarded-proto:"http", postman-token:"ad074595- 
76a5-474b-9711-7e071b12b3b0", x-b3-sampled:"1", x-forwarded- 
for:"10.244.2.1", accept:"*/*", 
authorization: "some-token-YJc4tg--34jPRziJNSACqNQ", x-b3- 
traceid:"6b40ff22781be67ba209cdc649b0b890", x-b3- 
spanid:"702684ddb62cfe6b", 
host:"portal-gateway.52.228.65.225.nip.io", 
cache-control:"no-cache", accept-encoding:"gzip, deflate, br", 
user-agent:"PostmanRuntime/7.22.0", 
Content-Type:"application/xml;charset=UTF-8"]]
2020-02-18T15:19:34.197666458Z [2m2020-02-18 15:19:34.197[0;39m  . 
[32mDEBUG 
[,6b40ff22781be67ba209cdc649b0b890,702684ddb62cfe6b,true][0;39m  . 
[35m9[0;39m [2m---[0;39m [2m[ XNIO-1 task-15][0;39m
like image 792
Omar Bahir Avatar asked Feb 12 '20 14:02

Omar Bahir


2 Answers

Section 3.5.1 of the JMS 2 specification states this about message properties:

Property names must obey the rules for a message selector identifier. See Section 3.8 “Message selection” for more information.

In regards to identifiers, section 3.8.1.1 states, in part:

An identifier is an unlimited-length character sequence that must begin with a Java identifier start character; all following characters must be Java identifier part characters. An identifier start character is any character for which the method Character.isJavaIdentifierStart returns true. This includes '_' and '$'. An identifier part character is any character for which the method Character.isJavaIdentifierPart returns true.

If you pass the character - into either Character.isJavaIdentifierStart or Character.isJavaIdentifierPart the return value is false. In other words, the - character in the name of a message property violates the JMS specification and therefore will cause an error.

like image 166
Justin Bertram Avatar answered Nov 19 '22 19:11

Justin Bertram


From the error message its obvious that you are using qpid JMS client for communication through queues. qpid client won’t allow any keys which violates java variable naming convention e.g. you won’t be able to send x-request-id in a queue’s header which qpid jms client is consuming as it’ll throw error. You need to take care of istio/zipkin to not to add certain headers (id you don’t need them actually) with the queue when its trying to communicate on azure bus. So you have to disable the istio/zipkin libraries to intercept the request for queues so that request to/from queue can be made without headers. This will fix the issue.

like image 1
user11377504 Avatar answered Nov 19 '22 18:11

user11377504