achilleasa / dart_amqp

Dart AMQP client implementing protocol version 0.9.1
MIT License
79 stars 40 forks source link

[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: FatalException: Lost connection to the server #128

Open adiltola-kod opened 6 days ago

adiltola-kod commented 6 days ago

I have a RabbitMQ broker in localhost in the port 15672 and I am trying to connect using your library to be able to listen messages through AMQP. I could do it with c# but in flutter I am not be able to connect.

`ConnectionSettings settings = ConnectionSettings( virtualHost: "mwmyjkim", host: "localhost", port: 15672, authProvider: const PlainAuthenticator( "username", "password"),

);
Client client = Client(settings: settings);
await client.connect();

Channel channel = await client.channel();
// auto-connect to localhost:5672 using guest credentials
Queue queue = await channel.queue(params.toString());
Consumer consumer = await queue.consume();
consumer.listen((AmqpMessage message) {
  // Get the payload as a string
  print(" [x] Received string: ${message.payloadAsString}");

  // Or unserialize to json
  print(" [x] Received json: ${message.payloadAsJson}");

  // Or just get the raw data as a Uint8List
  print(" [x] Received raw: ${message.payload}");

  // The message object contains helper methods for
  // replying, ack-ing and rejecting
  message.reply("world");
});

}`

Could not connect to 127.0.0.1:15672 after 1 attempts. Giving up" and if I put my ip address, it throws "FatalException: Lost connection to the server".

boaz-amit commented 6 days ago

Port 15672 is usually reserved for the Management UI you see in the browser and the HTTP API. If you're using the default standard ports, the port setting should probably be 5672.

adiltola-kod commented 6 days ago

15672 numaralı bağlantı noktası genellikle tarayıcıda gördüğünüz Yönetim Kullanıcı Arabirimi ve HTTP API'si için ayrılmıştır. Varsayılan standart bağlantı noktalarını kullanıyorsanız, bağlantı noktası ayarı büyük olasılıkla 5672 olmalıdır.

I am changing port what you say and i take this error E/flutter ( 4299): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: ConnectionFailedException: Could not connect to 127.0.0.1:5672 after 1 attempts. Giving up

boaz-amit commented 6 days ago

Have you made sure the local RabbitMQ server is running? If the server is running, do the server logs show the connection attempt?

adiltola-kod commented 6 days ago

Have you made sure the local RabbitMQ server is running? If the server is running, do the server logs show the connection attempt?

rabbitmq Server is running but connection couldn't see in logs

achilleasa commented 6 days ago

Note that the listening port section in the posted screenshot, shows that the amqp listener (which this library is meant to connect to) is bound to ::5672.

adiltola-kod commented 6 days ago

Gönderilen ekran görüntüsündeki dinleme bağlantı noktası bölümünün, amqp dinleyicisinin (bu kitaplığın bağlanması amaçlanan) ::5672'ye bağlı olduğunu gösterdiğini unutmayın.

https://github.com/achilleasa/dart_amqp/issues/128#issuecomment-2348419002