aj.toulan
aj.toulan

Reputation: 1432

Unable to connect RabbitBus to RabbitMQ

I am creating a RabbitBus.Bus with the RabbitBus.BusBuilder in my RabbitAdapter class.

public class RabbitAdapter
{
  private Bus _bus;

  public RabbitAdapter()
  {
    // The exchange and queue values are the same as what I see in RabbitMQ in browser
    _bus = new BusBuilder()
      .Configure(ctx => ctx.Consume<StatusUpdate>()
        .WithExchange("exchange")
        .WithQueue("Log"))
        .Build();
  }

  public void Init()
  {
    // The [url] and [port] values are the same as what I see in browser
    _bus.Connect("amqp://guest:guest@[url]:[port]/#/", TimeSpan.FromSeconds(10));
    _bus.Subscribe<StatusUpdate>(OnHandle);
  }

  private void OnHandle(IMessageContext<StatusUpdate> statusUpdateContext)
  {
    Console.WriteLine(statusUpdateContext.Id);
  }

  public void Start()
  {
  }
}

I know that I'm probably just missing something here. The _connectionFactory is not null in the Bus, but the _connection is. It seems to timeout, I've even tried making the timeout one minute.

Upvotes: 0

Views: 154

Answers (1)

Wiktor Zychla
Wiktor Zychla

Reputation: 48230

What you miss is although the console listens on 15672, the actual server listens on 5672 port.

Upvotes: 2

Related Questions