With EasyNetQ v0.63.0.448, RabbitMqClient v4.0.2 and RabbitMq server 3.6.5 when I try to create a bus like so...
bus = RabbitHutch.CreateBus(new ConnectionConfiguration()
{
Hosts = new[] { new HostConfiguration() { Host = hostName, Port = port } },
UserName = username,
Password = password,
}, x => { }).Advanced;
I'm getting the Error:
"Field Not Found 'RabbitMQ.Client.ConnectionFactory.AutomaticRecoveryEnabled'."
Is this an underlying incompatibility between easynetq and this version of Rabbit or is there a change in the API somewhere that I need to reflect?
It looks like that version of EasyNetQ is compiled against version 3.6.0 of RabbitMQ. In version 4 of RabbitMQ, AutomaticRecoveryEnabled and some other fields in ConnectionFactory were changed to properties which is a breaking change.
Until EasyNetQ is recompiled using version 4 of RabbitMQ you will have to use an older version of RabbitMQ - 3.6.5 seems to work for me.
Related
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?
I have used amq broker 7.10 and the issue is sorted in the broker.
I am new to gRPC and just exploring options for communications in my .net framework servers.
Due to the age and size of the server projects, it may be some time before these can be ported to .net 5+, but I want to allow for newer .net 5+ clients to connect, so want to replace the existing server WCF with something current.
My WCF always used Windows Authentication for encryption, which I can't wait to get away from due to cross domain issues, so would want to use TLS.
I am finding it hard to find examples on how to do this, especially in .net framework, as most examples are .net core.
Here is some typical(ish) example code:
static async Task Main()
{
const int port = 10042;
var server = new Grpc.Core.Server
{
Ports = { new ServerPort("localhost", 10042, ServerCredentials.Insecure) }
};
server.Services.AddCodeFirst<ICalculator>(new Calculator());
server.Services.AddCodeFirst<ITimeService>(new TimeService());
server.Start();
Console.WriteLine("server listening on port " + port);
Console.ReadKey();
await server.ShutdownAsync();
}
Ignore the AddCodeFirst these are some other experiments, however every example seems to use ServerCredentials.Insecure, and they all say to NOT use this in production (which I would not want to), but frustratingly they then do not show how to use a TLS certificate. How can I do this?
Also, for .net framework clients, typical code is
Channel channel = new Channel("localhost", 10042, ChannelCredentials.Insecure);
The only option seems to be Insecure
Finally also, for the server, it is possible to use a self signed certificate?
To use TLS with self-signed certs, you need to pass an instance of SslServerCredentials(keyCertPair, caRoots, clientCertRequestType) instead of ServerCredentials.Insecure as shown in this example
See https://github.com/jtattermusch/grpc-authentication-kubernetes-examples/blob/979345cca801b71eba9f8ffc67e13bf57c33a211/greeter-server/Program.cs#L43 from an older gRPC authentication talk https://github.com/jtattermusch/grpc-authentication-kubernetes-examples.
On the client side, you'll need to pass the corresponding CA roots (also see the same example).
I'm developing a new service based on our infrastructure that uses IBMMQ 8.0 (I've to admit that I'm not a guru of IBMMQ and I've used it as a simple integration without diving in it's implementation).
I'm trying right now to use It with amqpnetlite (in order to use it with .NET Core).
Till now here's my snippet
Address address = new Address("amqp://10.112.62.102:1414");
Connection connection = new Connection(address);
Session session = new Session(connection);
Message message = new Message("Hello AMQP!");
var sender = new SenderLink(session, "AONMQCOL1", "MQ_TEST");
sender.Send(message);
Console.WriteLine("Sent Hello AMQP!");
I got an exception AmqpException: The transport 'TcpTransport' is closed. when performing the Send. On the connection object I've got IsClosed = false so I think the connection is open.
Just as confirmation, what should I put as "address" and "name" on the SenderLink's constructor?
Thanks
What is the exact version of MQ Server you are running? i.e. issue the dspmqver command.
You need to be at Command Level 801 which was added in Fixack 2 of IBM MQ v8. i.e. IBM MQ v8.0.0.2. See here for more details.
Did you start the AMQP service and then start the channel?
i.e. runmqsc commands:
START SERVICE(SYSTEM.AMQP.SERVICE)
START CHANNEL(SYSTEM.DEF.AMQP)
Finally, are you connecting to the correct port #? The default port # is 5672.
Trying to get RabbitMQ wired up to play nice with TLS v1.2. Working with both a Java client and a .NET Core client. The Java client is working but the .NET one is pushing back. Here are my factory settings:
var factory = new ConnectionFactory
{
HostName = hostName,
VirtualHost = vHost,
UserName = username,
Password = password,
Port = 5671,
Ssl = {Enabled = true}
};
I’m getting this exception:
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception.
---> Interop+OpenSsl+SslException: SSL Handshake failed with OpenSSL error - SSL_ERROR_SSL.
---> Interop+Crypto+OpenSslCryptographicException: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version
Looking at the very tail end of the exception message it appears that the TLS version might be old but I have the latest version of RabbitMQ installed – 4.1.1
Dug into the RabbitMQ source for the ConnectionFactory class but cannot find anything relating to setting the TLS version. In my Java app it works thusly: factory.useSslProtocol("TLSv1.2");
Saw in another SO thread that an old version of Erlang might be the cause but I have the latest version (8.1) installed.
Any pointers on where to look next?
UPDATE: Foound the way to set the TLS property:
factory.Ssl.Version = SslProtocols.Tls12;
But now I'm getting a System.Security.Authentication.AuthenticationException: The remote certificate is invalid exception.
this worked for me:
Ssl = new SslOption
{
Version = SslProtocols.Tls12,
Enabled = true,
}
I am preparing to develop application that connects to Azure Service Bus. For development I want use Service Bus 1.1.
I have installed localy Service Bus 1.1 and it works fine when I am connecting with package Service Bus.v1_1 ver. 1.0.5.
But as I want eventually work with Azure I prefer to use package WindowsAzure Service Bus which as I know sholud work with Service Bus 1.1.
But when I want to execute:
namespaceManager.QueueExists(queueName)
with WindowsAzure.ServiceBus ver 3.1.2 package I receive:
'System.ArgumentException' ....
The remote server returned an error: (400) Bad Request. The api-version in the query string is not supported. Either remove it from the Uri or use one of '2012-03,2012-08,2013-04,2013-07'.
Adding ?api_version=2013-07 to Uri does not helps.
However sending message to queue that exists on local SB1.1 works well (Using WindowsAzure.ServiceBys 3.1.2).
So it just applies to connections with NamespaceManager.
Could anyone has any ideas why it does not work ?
The code I use for tests:
var cs ="Endpoint=sb://mylocalmachine/ServiceBusDefaultNamespace/;StsEndpoint=https://mylocalmachine:9355/ServiceBusDefaultNamespace/;RuntimePort=9354;ManagementPort=9355";
var queueName = "AAA";
var namespaceManager = NamespaceManager.CreateFromConnectionString(cs);
var messagingFactory = MessagingFactory.CreateFromConnectionString(cs);
var ver = namespaceManager.GetVersionInfo();
if (namespaceManager.QueueExists(queueName))
{
namespaceManager.DeleteQueue(queueName);
}
namespaceManager.CreateQueue(queueName);
QueueClient client = messagingFactory.CreateQueueClient(queueName);
client.Send(new BrokeredMessage("Hello! " + DateTime.Now));
client = messagingFactory.CreateQueueClient(queueName, ReceiveMode.ReceiveAndDelete);
BrokeredMessage message = client.Receive();
if (message != null)
{
Console.WriteLine(message.GetBody<string>());
}
Console.ReadKey();
To my knowledge the WindowsAzure.ServiceBus package is not compatible with on premises Windows Service Bus. We are stuck with using the old package.
I believe the libraries are source compatible for most things, so when you DO migrate to using Azure service bus instead of on-prem, then it should be as simple as swapping out the package and changing the authentication mechanisms and connection strings and recompiling and testing.