Search code examples
c#.netamqpactivemq-artemis

Apache.NMS.AMQP 2.0.0 library when publishing is throwing org.apache.qpid.proton.amqp.UnsignedByte cannot be cast to java.lang.byte error


I am using Apache.NMS.AMQP library in our .netcore 5 project. We connect to Apache ActiveMQ Artemis as a middle layer for the event driven architecture using AMQP protocol.

There is no issue in consuming messages from the same amqp protocol; but when publishing to a topic, we are getting some errors.

broker URI:

failover:(amqp://localhost:5672)?transport.startupMaxReconnectAttempts=1&transport.randomize=false

Code:

var _factory = new Apache.NMS.AMQP.ConnectionFactory(_connectURI);

IConnection connection = _factory.CreateConnection(username,password);
ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);

ITextMessage msg = session.CreateTextMessage(stringMessage);
var topicDestination = SessionUtil.GetTopic(session, topic);
connection.Start();`

IMessageProducer publisher = session.CreateProducer(topicDestination);
publisher.DeliveryMode = MsgDeliveryMode.Persistent;
publisher.Send(msg);

Error that I'm getting:

Message ID: xxxx:2:1:1-1 rejected, Description = org.apache.qpid.proton.amqp.UnsignedByte cannot be cast to java.lang.byte

I tried several combinations of sending the same from different methods, added Apache.NMS library on top of it as well. But still no luck.

Anyone have come across this issue?


Solution

  • I have used amq broker 7.10 and the issue is sorted in the broker.