I am unable to Publish a message to Solace broker via AMQP in .Net

Rameshhsivakumar
Rameshhsivakumar Member Posts: 3
edited April 2021 in PubSub+ Event Broker #1

Hello Team
Solace is running in my windows10 docker and i have configured to use 5670 port for AMQP.
when i try to connect without user name and password amqp://localhost:5670 it will connect but not able to send the message error i am getting is "Amqp.AmqpException: 'The transport 'TcpTransport' is closed.'".

if i connect using username and password i am getting error as Amqp.AmqpException: 'Sasl negotiation failed with code Auth.'

I am new to the solace please let me know how to resolve .
anything i need to change in configuration ?

Thank you

sample code
Address address = new Address("amqp://localhost:5670");

  Connection connection = new Connection(address);
  Session session = new Session(connection);

  Message message = new Message("Hello AMQP!");
  SenderLink sender = new SenderLink(session, "sender-link", "q1");
  sender.Send(message);
  Console.WriteLine("Sent Hello AMQP!");

  sender.Close();
  session.Close();
  connection.Close();
Tagged:

Answers

  • nram
    nram Member, Employee Posts: 80 Solace Employee

    Hi @Rameshhsivakumar , By any chance are you trying to connect to AMQP SSL Port instead of the Plain text port? You should be able to see the port assignments on your broker's WebUI under Message VPN / Services tab,

  • Rameshhsivakumar
    Rameshhsivakumar Member Posts: 3
    edited April 2021 #3

    Hello Ram
    Thanks for the reply . Ports are correct after changing the authentication to basic and none it started working.
    Now the question is am not able to connect with username and password as default and default .
    Do I need to change any settings in access control- client authentication - settings ?

    Currently I have enabled basic authentication and selected type to none.

    I also need how to connect using amqps?

    i am getting error Amqp.AmqpException: 'sasl-mechanisms(sasl-server-mechanisms:[])'

    this is the code
    Address address = new Address("amqp://default:default@localhost:5670");

      Connection connection = new Connection(address);
    
      Session session = new Session(connection);
    
      Message message = new Message("Hello AMQP!");
      SenderLink sender = new SenderLink(session, "sender-link", "q1");
      sender.Send(message);
      Console.WriteLine("Sent Hello AMQP!");
    
      sender.Close();
      session.Close();
      connection.Close();
    

    Thanks in advance

  • nram
    nram Member, Employee Posts: 80 Solace Employee

    Hi, To use usernames and passwords stored locally on the broker, pl change the Authentication Type to "Internal Database". If you are still unable to connect as "default" client-user, Pl check that "default" username is enabled. Pl see Access Control/Client Username tab. You can also try resetting the password if you suspect incorrect password.

  • Rameshhsivakumar
    Rameshhsivakumar Member Posts: 3

    Hello Ram
    Thanks for the reply but after setting type to internal database . Still I am getting an error amqp.amqpexception 'sasl negotiation failed with code says,'with user name and password as default.
    amqp:// default: default@localhost:5670

    Thank you

  • nram
    nram Member, Employee Posts: 80 Solace Employee

    Hi, Can you retry one more time after resetting the default username password to "default" ? just so we can rule password mismatches out.
    couple of things to try:

    • Since you mentioned you are running Solace PS+ on Docker, do you see anything more informative on the broker event log (/usr/sw/jail/logs/event.log on container host)
    • are you able to publish with non AMQP (eg: Try Me UI) using other protocols ?
    • try with non-default user ?
  • pruffieux
    pruffieux Member Posts: 14 ✭✭

    Just for the information, this answer helped me to make the RabbitMQ bridge with shovel as if "none" is selected (as default value in Docker image) I received a "sasl_not_supported" and no idea why. By just setting up "Internal database" it was working without issue. Perhaps it worth to mentions that if people are using internal docker image instead of the cloud version in the tutorial: https://codelabs.solace.dev/codelabs/solace-rabbit-shovel/#0