dart_amqp
dart_amqp copied to clipboard
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: FatalException: Lost connection to the server
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".