Hunt AMQP Client 1.0.0 beta is released!

Hunt AMQP Client based AMQP protocol 1.0, support for RabbitMQ and other AMQP Server. Ported from Vert.x AMQP Client.

Sample code:
```D

import hunt.amqp;
import hunt.logging;

void main()
{
  AmqpClientOptions options = new AmqpClientOptions()
  .setHost("localhost")
  .setPort(5672)
  .setUsername("test")
  .setPassword("123");

   AmqpClient client = AmqpClient.create(options);

   client.connect(new class Handler!AmqpConnection {
     void handle(AmqpConnection conn)
     {
        if (conn is null)
        {
          logWarning("Unable to connect to the broker");
          return;
        }

        logInfo("Connection succeeded");
        conn.createSender("my-queue",new class Handler!AmqpSender{
          void handle(AmqpSender sender)
          {
              if(sender is null)
              {
                logWarning("Unable to create a sender");
                return;
              }
              for (int i = 0 ; i < 100; ++i)
              {
sender.send(AmqpMessage.create().withBody("hello world").build());
                logInfo("send complite");
              }
          }
        });

conn.createReceiver("my-queue", new class Handler!AmqpReceiver {
          void handle(AmqpReceiver recv)
          {
              if(recv is null)
              {
                logWarning("Unable to create a receiver");
                return;
              }
              recv.handler(new class Handler!AmqpMessage {
                void handle(AmqpMessage msg){
                  logInfo("Received %s" , msg.bodyAsString());
                }
              });
          }
       });
     }
   });
}
```

DLang Code:
https://code.dlang.org/packages/hunt-amqp-client

Github Repository:
https://github.com/huntlabs/hunt-amqp-client

Reply via email to