无法使用MassTransit连接到Amazon MQ

时间:2018-04-24 21:08:43

标签: masstransit amazon-mq

我正在尝试使用最新版本的MassTransit.ActiveMQ包将消息发布到Amazon MQ实例。

我在MassTransit源代码中找到了一个示例,显示了与Amazon MQ的成功连接。我尝试使用我的Amazon MQ实例在我自己的应用程序中复制该示例:

public static void Main(string[] args)
{
    Console.WriteLine("Creating connection to Amazon MQ...");
    var busControl = Bus.Factory.CreateUsingActiveMq(cfg =>
    {
        cfg.Host("b-abcxyz-1.mq.us-east-1.amazonaws.com", 61617, h =>
        {
            h.Username("user");
            h.Password("pass");
            h.UseSsl();
        });
    });

    busControl.StartAsync().Wait();

    Console.WriteLine("Connected.");
    Console.ReadKey();

    busControl.StopAsync().Wait();
}

尝试启动总线时收到以下错误。它似乎使用activemq方案而不是像我预期的那样ssl

ActiveMQ Connect Failed: ReceiveTranport Faulted, Restartingactivemq://b-abcxyz-1.mq.us-east-1.amazonaws.com:61617/

Unhandled Exception: System.AggregateException: One or more errors occurred. (ReceiveTranport Faulted, Restartingactivemq://b-abcxyz-1.mq.us-east-1.amazonaws.com:61617/) ---> MassTransit.ActiveMqTransport.ActiveMqConnectException: ReceiveTranport Faulted, Restartingactivemq://b-72f33f22-0856-47ef-a5fb-e0ab19ab7aff-1.mq.us-east-1.amazonaws.com:61617/ ---> System.NotSupportedException: The requested security protocol is not supported.
   at System.Net.SecurityProtocol.ThrowOnNotAllowed(SslProtocols protocols, Boolean allowNone)
   at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
   at Apache.NMS.ActiveMQ.Transport.Tcp.SslTransport.CreateSocketStream()
   at Apache.NMS.ActiveMQ.Transport.Tcp.TcpTransport.Start()
   at Apache.NMS.ActiveMQ.Transport.TransportFilter.Start()
   at Apache.NMS.ActiveMQ.Transport.TransportFilter.Start()
   at Apache.NMS.ActiveMQ.Transport.WireFormatNegotiator.Start()
   at Apache.NMS.ActiveMQ.Transport.TransportFilter.Start()
   at Apache.NMS.ActiveMQ.Transport.TransportFilter.Start()
   at Apache.NMS.ActiveMQ.Connection.CheckConnected()
   at Apache.NMS.ActiveMQ.Connection.Start()
   at MassTransit.ActiveMqTransport.Transport.ConnectionContextFactory.<CreateConnection>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.ActiveMqTransport.Transport.ConnectionContextFactory.<CreateSharedConnection>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at GreenPipes.Agents.PipeContextSupervisor`1.<GreenPipes-IPipeContextSource<TContext>-Send>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at GreenPipes.Agents.PipeContextSupervisor`1.<GreenPipes-IPipeContextSource<TContext>-Send>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at GreenPipes.Agents.PipeContextSupervisor`1.<GreenPipes-IPipeContextSource<TContext>-Send>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.ActiveMqTransport.Transport.ActiveMqReceiveTransport.<<Receiver>b__15_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at MassTransit.ActiveMqTransport.Transport.ActiveMqReceiveTransport.<<Receiver>b__15_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.Policies.PipeRetryExtensions.<Retry>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at MassTransit.Policies.PipeRetryExtensions.<Retry>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.ActiveMqTransport.Transport.ActiveMqReceiveTransport.<Receiver>d__15.MoveNext()
   --- End of inner exception stack trace ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.ActiveMqTransport.Transport.ActiveMqHost.Handle.<ReadyOrNot>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.MassTransitBus.Handle.<ReadyOrNot>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at GreenPipes.Internals.Extensions.TaskExtensions.<UntilCompletedOrCanceled>d__0`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at MassTransit.MassTransitBus.<StartAsync>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at MassTransit.MassTransitBus.<StartAsync>d__27.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at MassTransitActiveMQ.Program.Main(String[] args) in /home/ec2-user/MassTransitActiveMQ/MassTransitActiveMQ/Program.cs:line

1 个答案:

答案 0 :(得分:2)

我已经解决了与SSL(需要TLS)协议相关的问题,并将很快提交修复程序。它很快就会在5.0.2版本中提供。