Mathias F
Mathias F

Reputation: 15901

Can't connect to Amazon MQ broker using NMS

I created a broker on AWS where I have a list of endpoints like this:

amqp+ssl://b-***-1.mq.us-east-1.amazonaws.com:5671
ssl://b-***-1.mq.us-east-1.amazonaws.com:61617
stomp+ssl://b-***-1.mq.us-east-1.amazonaws.com:61614
mqtt+ssl://b-***-1.mq.us-east-1.amazonaws.com:8883

I tried to call the endpoints in a .NET application by using Apache.NMS.ActiveMQ, but I always get the error:

Apache.NMS.NMSConnectionException: 'No IConnectionFactory implementation found for connection URI: amqps://b***-1.mq.us-east-2.amazonaws.com:5671 

This is my application:

using System;
using System.Threading;
using Apache.NMS;
using Apache.NMS.Util;
using Apache.NMS.ActiveMQ;

namespace Apache.NMS.ActiveMQ.Test
{
  public class TestMain
  {
    public static void Main()
    {
        Uri connecturi = new Uri("amqp+ssl://b-***-1.mq.us-east-2.amazonaws.com:5671");
       
        Console.WriteLine("About to connect to " + connecturi);

        IConnectionFactory factory = new NMSConnectionFactory(connecturi);

.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Apache.NMS.ActiveMQ" Version="2.0.0" />
  </ItemGroup>

</Project>

I opened the ports for inbound traffic and can access the broker console.

I also tried amqp://b-***-1.mq.us-east-1.amazonaws.com:5671 but without luck.

I can succesfully interact with a local server using:

Uri connecturi = new Uri("tcp://localhost:61616?wireFormat.tightEncodingEnabled=true");

Is there something missing?

Upvotes: -1

Views: 306

Answers (1)

Tim Bish
Tim Bish

Reputation: 18356

You appear to be trying to connect to an AMQP endpoint from the .NET NMS.ActiveMQ openwire protocol client which will definitely not work. You need to either use an .NET AMQP client such as the NMS.AMQP client or point the client you already have at the Openwire port (61617) and use the proper URI for that client which is likely ("ssl://:") and of course make an needed configuration changes needed for the client to find the right SSL certificates.

Upvotes: 0

Related Questions