/// <summary> /// 메세지 요청 /// </summary> /// <param name="request">요청 메세지</param> /// <param name="messageConfig">메세지 요청 설정</param> /// <returns>응답 메세지</returns> public byte[] Request(byte[] request, MessageConfiguration messageConfig) { Preconditions.CheckNotNull(request, "request"); var task = rpc.Request(request, messageConfig); task.Wait(); return(task.Result); }
/// <summary> /// 메세시 게시 /// </summary> /// <param name="messageConfig">메세지 게시 설정</param> /// <param name="message">게시할 메세지</param> public void Publish(MessageConfiguration messageConfig, byte[] message) { var exchange = new Exchange(messageConfig.ExchangeName); advancedBus.Publish(exchange, messageConfig.RoutingKey, false, new MessageProperties() { DeliveryMode = MessageDeliveryMode.Persistent }, message); }
/// <summary> /// 메세지 구독 /// </summary> /// <param name="onMessage">메세지 도착시 실행될 Func</param> /// <param name="messageConfig">메세지 구독 설정</param> public IDisposable Subscribe(Func <byte[], MessageProperties, MessageReceivedInfo, Task> onMessage, MessageConfiguration messageConfig) { var queue = new Queue(messageConfig.QueueName, false); return(advancedBus.Consume(queue, onMessage, config => config.WithPrefetchCount(messageConfig.PrefetchCount))); //return advancedBus.Consume(queue, onMessage); }