저는 amqplib -> EasyNetQ에서 게시하는 것과 관련하여 이미이 질문을했으며 EasyNetQ 작성자의 도움을 받아 작업했습니다.RabbitMQ, NodeJS (amqplib)를 사용하는 EasyNetQ - 구독
이제 다른 방법으로 문제가 있습니다.
간략하게 "작동"했지만 그 후에 내가 만든 모든 대기열을 정리하고 지금은 작동하지 않습니다. (amqplib에서 ENQ 로의 게시는 여전히 작동하지만 ENQ에서 amqplib로 ' 티).
이 코드가있는 경우 :
Bus.SubscribeAsync<BusManifestHolla>(HollaSubID_1,
msg => Task.Factory.StartNew(() => {
Console.WriteLine("LOOK===> Received Manifest Holla ID {0}", msg.ManifestID.ToString());
Console.WriteLine("LOOK===> Responding with Manifest Yo ID {0}", HollaSubID_1);
Bus.PublishAsync(new BusManifestYo { ManifestID = msg.ManifestID, ServiceName = HollaSubID_1 });
})
);
이/amqplib 아래/그것을 소비 무엇을 구독하는 I 플러그인 할 노드에서 필요합니까를?
Play.AMPQ.then((connection) => {
return connection.createChannel().then((channel) => {
return channel.assertExchange(dto.BusManifestYo.Type, 'topic', { durable: true, autoDelete: false }).then((okExchangeReply) => {
return channel.assertQueue(dto.BusManifestYo.Type).then((ok) => {
return channel.consume(ok.queue, (msg) => {
console.log(util.format('Received message: %s', msg.content.toString()));
var bmy: dto.interfaces.IBusManifestYo = JSON.parse(msg.content.toString());
channel.ack(msg);
});
});
});
});
});
UPDATE
내가 EasyNetQ 처음 (그래서 BORK 큐하지 않습니다) 노드에서 'assertQueue'호출을 제거 다음 큐 (이 게시 것)를 작성하고있는 경우 그런 다음 명명 규칙을 따르십시오. 물론 이것은 실제 솔루션이 아니지만 누군가가 솔루션을 가리킬 때 도움이 될 수 있습니까?
업데이트 # 2
글쎄, 분명히 나는 교환에 큐를 결합 할 필요가 있었다. 여기에 새로운 작업 코드가 있습니다 :
Play.AMPQ.then((connection) => {
return connection.createChannel().then((channel) => {
channel.on('error', Play.handleChannelError);
return channel.assertQueue(dto.BusManifestYo.Type + '_Node', { durable: true, exclusive: false, autoDelete: false }).then((okQueueReply) => {
return channel.assertExchange(dto.BusManifestYo.Type, 'topic', { durable: true, autoDelete: false }).then((okExchangeReply) => {
return channel.bindQueue(dto.BusManifestYo.Type + '_Node', dto.BusManifestYo.Type, '#').then((okBindReply) => {
return channel.consume(dto.BusManifestYo.Type + '_Node', (msg) => {
console.log(util.format('Received message: %s', msg.content.toString()));
var bmy: dto.interfaces.IBusManifestYo = JSON.parse(msg.content.toString());
channel.ack(msg);
});
});
});
});
});
});
나에게 분명하지 않은 한 가지는 '#'에 대한 바인딩의 패턴을 설정하는 곳입니다. 작동하고 있지만 ENQ를 사용했기 때문에 값을 넣을뿐입니다. 다른 값은 작동하지 않는 것 같습니다 ...
언젠가는 현재 기본 pub/sub를 다루고 보내기/받기를 다루는 현재 노드 구현을 게시 할 것입니다.하지만 작품에서 nod 구현이 아직 없다면 놀랄 것입니다. – Michael