public SetCorrelationIdMessageSendTopology(IMessageCorrelationId <T> messageCorrelationId) { if (messageCorrelationId == null) { throw new ArgumentNullException(nameof(messageCorrelationId)); } _filter = new SetCorrelationIdFilter <T>(messageCorrelationId); }
public MessageCorrelationIdEventCorrelationBuilder(SagaStateMachine <TInstance> machine, Event <TData> @event, IMessageCorrelationId <TData> messageCorrelationId) { var configurator = new MassTransitEventCorrelationConfigurator <TInstance, TData>(machine, @event, null); configurator.CorrelateById(x => messageCorrelationId.TryGetCorrelationId(x.Message, out var correlationId) ? correlationId : throw new ArgumentException($"The message {TypeMetadataCache<TData>.ShortName} did not have a correlationId")); _configurator = configurator; }
public bool TryGetMessageCorrelationId(out IMessageCorrelationId <TMessage> messageCorrelationId) { foreach (ICorrelationIdSelector <TMessage> selector in _selectors) { if (selector.TryGetSetCorrelationId(out messageCorrelationId)) { return(true); } } messageCorrelationId = null; return(false); }
public bool TryGetSetCorrelationId(out IMessageCorrelationId <T> messageCorrelationId) { var correlatedByInterface = typeof(T).GetInterface <CorrelatedBy <Guid> >(); if (correlatedByInterface != null) { var objectType = typeof(CorrelatedByMessageCorrelationId <>).MakeGenericType(typeof(T)); messageCorrelationId = (IMessageCorrelationId <T>)Activator.CreateInstance(objectType); return(true); } messageCorrelationId = null; return(false); }
public bool TryGetSetCorrelationId(out IMessageCorrelationId <T> messageCorrelationId) { var propertyInfo = typeof(T).GetProperty(_propertyName); if (propertyInfo != null && propertyInfo.PropertyType == typeof(Guid)) { messageCorrelationId = new PropertyMessageCorrelationId <T>(propertyInfo); return(true); } if (propertyInfo != null && propertyInfo.PropertyType == typeof(Guid?)) { messageCorrelationId = new NullablePropertyMessageCorrelationId <T>(propertyInfo); return(true); } messageCorrelationId = null; return(false); }
public void SetCorrelationId(IMessageCorrelationId <TMessage> messageCorrelationId) { _selectors.Insert(0, new SetCorrelationIdSelector <TMessage>(messageCorrelationId)); }
public bool TryGetSetCorrelationId(out IMessageCorrelationId <T> messageCorrelationId) { messageCorrelationId = _messageCorrelationId; return(true); }
public SetCorrelationIdSelector(IMessageCorrelationId <T> messageCorrelationId) { _messageCorrelationId = messageCorrelationId; }
public SetCorrelationIdFilter(IMessageCorrelationId <T> messageCorrelationId) { _messageCorrelationId = messageCorrelationId; }