我正在尝试使用最新版本的 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