public LinkProducerMessage(byte[] body, LinkMessageProperties properties, LinkPublishProperties publishProperties, CancellationToken cancellation) : base(cancellation) { Body = body; Properties = properties; PublishProperties = publishProperties; }
private LinkProducerBuilder ( LinkProducerBuilder prev, TimeSpan?recoveryInterval = null, TimeSpan?publishTimeout = null, bool?confirmsMode = null, bool?setUserId = null, ILinkMessageIdGenerator messageIdGenerator = null, LinkPublishProperties publishProperties = null, LinkMessageProperties messageProperties = null, ILinkProducerTopologyHandler topologyHandler = null, LinkStateHandler <LinkProducerState> stateHandler = null, LinkStateHandler <LinkChannelState> channelStateHandler = null, ILinkSerializer serializer = null, LinkTypeNameMapping typeNameMapping = null ) : this ( prev._link, recoveryInterval ?? prev._recoveryInterval, serializer ?? prev._serializer, publishTimeout ?? prev._publishTimeout, confirmsMode ?? prev._confirmsMode, setUserId ?? prev._setUserId, messageIdGenerator ?? prev._messageIdGenerator, publishProperties ?? prev._publishProperties.Clone(), messageProperties ?? prev._messageProperties.Clone(), topologyHandler ?? prev._topologyHandler, stateHandler ?? prev._stateHandler, channelStateHandler ?? prev._channelStateHandler, typeNameMapping ?? prev._typeNameMapping ) { }
public LinkProducerBuilder ( Link link, TimeSpan recoveryInterval, ILinkSerializer serializer, TimeSpan?publishTimeout = null, bool?confirmsMode = null, bool?setUserId = null, ILinkMessageIdGenerator messageIdGenerator = null, LinkPublishProperties publishProperties = null, LinkMessageProperties messageProperties = null, ILinkProducerTopologyHandler topologyHandler = null, LinkStateHandler <LinkProducerState> stateHandler = null, LinkStateHandler <LinkChannelState> channelStateHandler = null, LinkTypeNameMapping typeNameMapping = null ) { _link = link ?? throw new ArgumentNullException(nameof(link)); _confirmsMode = confirmsMode ?? false; _setUserId = setUserId ?? true; _publishTimeout = publishTimeout ?? Timeout.InfiniteTimeSpan; _recoveryInterval = recoveryInterval; _messageIdGenerator = messageIdGenerator ?? new LinkGuidMessageIdGenerator(); _publishProperties = publishProperties ?? new LinkPublishProperties(); _messageProperties = messageProperties ?? new LinkMessageProperties(); _topologyHandler = topologyHandler; _stateHandler = stateHandler ?? ((old, @new) => { }); _channelStateHandler = channelStateHandler ?? ((old, @new) => { }); _serializer = serializer; _typeNameMapping = typeNameMapping ?? new LinkTypeNameMapping(); }
public ILinkProducerBuilder PublishProperties(LinkPublishProperties value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } return(new LinkProducerBuilder(this, publishProperties: value.Clone())); }
/// <summary> /// Creates new instance from another message /// </summary> /// <param name="message">Message instance</param> /// <param name="publishProperties">Publish properties</param> public LinkPublishMessage( ILinkMessage <TBody> message, LinkPublishProperties publishProperties = null ) : this( message.Body, message.Properties, publishProperties ) { }
/// <summary> /// Creates new instance /// </summary> /// <param name="body">Body value</param> /// <param name="properties">Message properties</param> /// <param name="publishProperties">Publish properties</param> public LinkPublishMessage( TBody body, LinkMessageProperties properties = null, LinkPublishProperties publishProperties = null ) : base( body, properties ) { PublishProperties = publishProperties ?? new LinkPublishProperties(); }
public void SetMessageId() { var gen = new LinkGuidMessageIdGenerator(); var body = new byte[1]; var props = new LinkMessageProperties(); var pubProps = new LinkPublishProperties(); gen.SetMessageId(body, props, pubProps); Assert.NotNull(props.MessageId); Assert.True(Guid.TryParse(props.MessageId, out var _)); }
public LinkProducerConfiguration( TimeSpan publishTimeout, TimeSpan recoveryInterval, ILinkMessageIdGenerator messageIdGenerator, bool confirmsMode, bool setUserId, LinkPublishProperties publishProperties, LinkMessageProperties messageProperties, ILinkProducerTopologyHandler topologyHandler, LinkStateHandler <LinkProducerState> stateHandler, ILinkSerializer serializer, LinkTypeNameMapping typeNameMapping ) { if (publishTimeout < TimeSpan.Zero && publishTimeout != Timeout.InfiniteTimeSpan) { throw new ArgumentOutOfRangeException(nameof(publishTimeout), "Must be greater or equal TimeSpan.Zero or equal Timeout.InfiniteTimeSpan"); } if (recoveryInterval < TimeSpan.Zero) { throw new ArgumentOutOfRangeException(nameof(recoveryInterval), "Must be greater than TimeSpan.Zero"); } PublishTimeout = publishTimeout; RecoveryInterval = recoveryInterval; MessageIdGenerator = messageIdGenerator ?? throw new ArgumentNullException(nameof(messageIdGenerator)); ConfirmsMode = confirmsMode; SetUserId = setUserId; _publishProperties = publishProperties ?? throw new ArgumentNullException(nameof(publishProperties)); _messageProperties = messageProperties ?? throw new ArgumentNullException(nameof(messageProperties)); TopologyHandler = topologyHandler ?? throw new ArgumentNullException(nameof(topologyHandler)); StateHandler = stateHandler ?? throw new ArgumentNullException(nameof(stateHandler)); Serializer = serializer; TypeNameMapping = typeNameMapping ?? throw new ArgumentNullException(nameof(typeNameMapping)); }