Stomp.net from docker : The Connection is already closed!
fjmalan opened this issue · 2 comments
Hi Dave
I'm trying to connect to a SSL ActiveMQ stomp server with .Net core
I can connect to the queue when running the project with MacOS or Windows 10
The problem only happens when i publish the service to a docker container.
Connection / SSL Settings
private ConnectionFactory GetConnectionSettings(string brokerUri)
{
return new ConnectionFactory(brokerUri, new StompConnectionSettings
{
UserName = _configuration["USER"],
Password = _configuration["PASSWORD"],
TransportSettings =
{
SslSettings =
{
ServerName = _configuration["HOST"],
ClientCertSubject = "",
KeyStoreName = "My",
KeyStoreLocation = "LocalMachine"
}
},
SkipDesinationNameFormatting = false, // Determines whether the destination name formatting should be skipped or not.
SetHostHeader = true, // Determines whether the host header will be added to messages or not
HostHeaderOverride = null // Can be used to override the content of the host header
});
}
_addressRX = $"ssl://{_configuration["HOST"]}:{_configuration["PORT"]}";
_connectionRX = GetConnectionSettings(_addressRX);
var connection = _connectionRX.CreateConnection();
connection.Start();
I get the exception connection.Start();
Stomp.Net.Stomp.ConnectionClosedException: The connection is already closed! ErrorCode: at Stomp.Net.Stomp.Connection.CheckConnected() at Stomp.Net.Stomp.Connection.Start() at deposita_service.Services.DepositaService.StartAsync(CancellationToken cancellationToken) in /app/Services/DepService.cs:line 203
DockerFile
FROM microsoft/dotnet:2.0-sdk
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
ENTRYPOINT ["dotnet", "out/dep-service.dll"]`
Hi
Thanks for reporting the problem.
Sadly, I don’t have the possibility to test with a docker container.
The exception gets thrown when the library detects a problem with the connection to the broker.
In such a case the connection will be closed and has to be reestablished.
Do you have the logging enabled? (If not see: https://gist.github.com/DaveSenn/92265c1ba45afe258afb9b13c28c5b93 for how to use the internal logging)
Can you see any helpful information in the log output?