public MessageSubscribtionInfo(DataContractKey contractKey, ICallHandler handler, XmlObjectSerializer serializer, bool receiveSelfPublish, IEnumerable<BusHeader> filterHeaders) { _handler = handler; _serializer = serializer; _filterInfo = new MessageFilterInfo(contractKey, receiveSelfPublish, filterHeaders); }
public bool Register(Type type, MessageFilterInfo filterInfo, ICallHandler handler) { return _subscriptions.TryAdd(type, new SubscriptionInfo { FilterInfo = filterInfo, Handler = handler }); }
private bool IsMessageSurvivesFilter(MessageFilterInfo filterInfo, RawBusMessage busMessage) { // TODO: Add header filtering if (filterInfo.ReceiveSelfPublish) return true; bool selfPublished = Equals(busMessage.BusId, _busId); return !selfPublished; }
public static void QueueBind(this IModel model, string queue, string exchange, string routingKey, MessageFilterInfo filterInfo) { IDictionary<string, object> arguments = new Dictionary<string, object>(); arguments.Add(MessagingConstants.HeaderNames.Name, filterInfo.ContractKey.Name); arguments.Add(MessagingConstants.HeaderNames.NameSpace, filterInfo.ContractKey.Ns); foreach (BusHeader header in filterInfo.FilterHeaders) { arguments.Add(header.Name, header.Value); } model.QueueBind(queue, exchange, routingKey, arguments); }
public bool Subscribe(Type dataType, ICallHandler handler, IEnumerable<BusHeader> filter) { DataContractKey key = dataType.GetDataContractKey(); MessageFilterInfo filterInfo = new MessageFilterInfo(key, filter ?? Enumerable.Empty<BusHeader>()); return _registrationAction(dataType, filterInfo, handler); }