예제 #1
0
 public static Func <TimeSpan?, TimeSpan> ToFunc(this GetTimeToKeep timeToKeep)
 {
     if (timeToKeep == null)
     {
         return(null);
     }
     return(x => timeToKeep(x));
 }
예제 #2
0
 public void Add <T>(Func <Task <T> > streamFactory, GetTimeToKeep timeToKeep = null, Action cleanup = null) where T : Stream
 {
     Guard.AgainstNull(streamFactory, nameof(streamFactory));
     Streams.Add("", new OutgoingStream
     {
         AsyncStreamFactory = async() => await streamFactory().ConfigureAwait(false),
         TimeToKeep         = timeToKeep,
         Cleanup            = cleanup
     });
 }
예제 #3
0
 public void AddBytes(byte[] bytes, GetTimeToKeep timeToKeep = null, Action cleanup = null)
 {
     Guard.AgainstNull(bytes, nameof(bytes));
     Streams.Add("", new OutgoingStream
     {
         BytesInstance = bytes,
         TimeToKeep    = timeToKeep,
         Cleanup       = cleanup
     });
 }
 public SendRegistration(IPersister persister, GetTimeToKeep timeToKeep)
     : base(
         stepId: $"{AssemblyHelper.Name}Send",
         behavior: typeof(SendBehavior),
         description: "Saves the payload into the shared location",
         factoryMethod: builder => new SendBehavior(persister, timeToKeep))
 {
     InsertAfter("MutateOutgoingMessages");
     InsertBefore("ApplyTimeToBeReceived");
 }
예제 #5
0
 public void AddBytes(Func <byte[]> bytesFactory, GetTimeToKeep timeToKeep = null, Action cleanup = null)
 {
     Guard.AgainstNull(bytesFactory, nameof(bytesFactory));
     Streams.Add("", new OutgoingStream
     {
         BytesFactory = bytesFactory,
         TimeToKeep   = timeToKeep,
         Cleanup      = cleanup
     });
 }
예제 #6
0
 public void Add(Stream stream, GetTimeToKeep timeToKeep = null, Action cleanup = null)
 {
     Guard.AgainstNull(stream, nameof(stream));
     Streams.Add("", new OutgoingStream
     {
         StreamInstance = stream,
         TimeToKeep     = timeToKeep,
         Cleanup        = cleanup
     });
 }
예제 #7
0
 public void Add(Func <Stream> streamFactory, GetTimeToKeep timeToKeep = null, Action cleanup = null)
 {
     Guard.AgainstNull(streamFactory, nameof(streamFactory));
     Streams.Add("", new OutgoingStream
     {
         StreamFactory = streamFactory,
         TimeToKeep    = timeToKeep,
         Cleanup       = cleanup
     });
 }
예제 #8
0
 public void Add(string name, Stream stream, GetTimeToKeep timeToKeep = null, Action cleanup = null, IReadOnlyDictionary <string, string> metadata = null)
 {
     Guard.AgainstNull(name, nameof(name));
     Guard.AgainstNull(stream, nameof(stream));
     Inner.Add(name, new Outgoing
     {
         StreamInstance = stream,
         TimeToKeep     = timeToKeep,
         Cleanup        = cleanup.WrapCleanupInCheck(name),
         Metadata       = metadata
     });
 }
예제 #9
0
 public void AddBytes(string name, Func <byte[]> bytesFactory, GetTimeToKeep timeToKeep = null, Action cleanup = null, IReadOnlyDictionary <string, string> metadata = null)
 {
     Guard.AgainstNull(name, nameof(name));
     Guard.AgainstNull(bytesFactory, nameof(bytesFactory));
     Inner.Add(name, new Outgoing
     {
         BytesFactory = bytesFactory.WrapFuncInCheck(name),
         TimeToKeep   = timeToKeep,
         Cleanup      = cleanup.WrapCleanupInCheck(name),
         Metadata     = metadata
     });
 }
예제 #10
0
 public void AddBytes(string name, byte[] bytes, GetTimeToKeep timeToKeep = null, Action cleanup = null, IReadOnlyDictionary <string, string> metadata = null)
 {
     Guard.AgainstNull(name, nameof(name));
     Guard.AgainstNull(bytes, nameof(bytes));
     Inner.Add(name, new Outgoing
     {
         BytesInstance = bytes,
         TimeToKeep    = timeToKeep,
         Cleanup       = cleanup.WrapCleanupInCheck(name),
         Metadata      = metadata
     });
 }
예제 #11
0
        /// <summary>
        /// Enable SQL attachments for this endpoint.
        /// </summary>
        public static AttachmentSettings EnableAttachments(
            this EndpointConfiguration configuration,
            string connection,
            GetTimeToKeep timeToKeep)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(timeToKeep, nameof(timeToKeep));
            Guard.AgainstNullOrEmpty(connection, nameof(connection));
            var settings    = configuration.GetSettings();
            var attachments = new AttachmentSettings(() => OpenConnection(connection), timeToKeep);

            return(SetAttachments(configuration, settings, attachments));
        }
예제 #12
0
        /// <summary>
        /// Enable SQL attachments for this endpoint.
        /// </summary>
        public static AttachmentSettings EnableAttachments(
            this EndpointConfiguration configuration,
            Func <Task <SqlConnection> > connectionFactory,
            GetTimeToKeep timeToKeep)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(timeToKeep, nameof(timeToKeep));
            Guard.AgainstNull(connectionFactory, nameof(connectionFactory));
            var settings    = configuration.GetSettings();
            var attachments = new AttachmentSettings(connectionFactory, timeToKeep);

            return(SetAttachments(configuration, settings, attachments));
        }
예제 #13
0
 public void Add <T>(string name, Func <Task <T> > streamFactory, GetTimeToKeep timeToKeep = null, Action cleanup = null, IReadOnlyDictionary <string, string> metadata = null)
     where T : Stream
 {
     Guard.AgainstNull(name, nameof(name));
     Guard.AgainstNull(streamFactory, nameof(streamFactory));
     Inner.Add(name, new Outgoing
     {
         AsyncStreamFactory = streamFactory.WrapStreamFuncTaskInCheck(name),
         TimeToKeep         = timeToKeep,
         Cleanup            = cleanup.WrapCleanupInCheck(name),
         Metadata           = metadata
     });
 }
예제 #14
0
        /// <summary>
        /// Enable SQL attachments for this endpoint.
        /// </summary>
        public static AttachmentSettings EnableAttachments(
            this EndpointConfiguration configuration,
            Func <Task <SqlConnection> > connectionFactory,
            GetTimeToKeep timeToKeep)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(timeToKeep, nameof(timeToKeep));
            Guard.AgainstNull(connectionFactory, nameof(connectionFactory));
            var settings    = configuration.GetSettings();
            var attachments = new AttachmentSettings(connectionFactory, timeToKeep);

            settings.Set <AttachmentSettings>(attachments);
            configuration.EnableFeature <AttachmentFeature>();
            configuration.DisableFeature <AttachmentsUsedWhenNotEnabledFeature>();
            return(attachments);
        }
예제 #15
0
        /// <summary>
        /// Enable SQL attachments for this endpoint.
        /// </summary>
        public static AttachmentSettings EnableAttachments(
            this EndpointConfiguration configuration,
            string fileShare,
            GetTimeToKeep timeToKeep)
        {
            Guard.AgainstNull(configuration, nameof(configuration));
            Guard.AgainstNull(timeToKeep, nameof(timeToKeep));
            Guard.AgainstNullOrEmpty(fileShare, nameof(fileShare));
            var settings    = configuration.GetSettings();
            var attachments = new AttachmentSettings(fileShare, timeToKeep);

            settings.Set(attachments);
            configuration.EnableFeature <AttachmentFeature>();
            configuration.DisableFeature <AttachmentsUsedWhenNotEnabledFeature>();
            return(attachments);
        }
 public SendBehavior(Func <Task <SqlConnection> > connectionFactory, IPersister persister, GetTimeToKeep timeToKeep)
 {
     this.connectionFactory = connectionFactory;
     this.persister         = persister;
     endpointTimeToKeep     = timeToKeep;
 }
예제 #17
0
 internal AttachmentSettings(Func <Task <SqlConnection> > connectionFactory, GetTimeToKeep timeToKeep)
 {
     TimeToKeep        = timeToKeep;
     ConnectionFactory = connectionFactory;
 }
예제 #18
0
 public void AddBytes(byte[] bytes, GetTimeToKeep timeToKeep = null, Action cleanup = null, IReadOnlyDictionary <string, string> metadata = null)
 {
     AddBytes("default", bytes, timeToKeep, cleanup, metadata);
 }
 internal AttachmentSettings(Func <Task <SqlConnection> > connectionFactory, GetTimeToKeep timeToKeep)
 {
     Guard.AgainstNull(connectionFactory, nameof(connectionFactory));
     TimeToKeep        = timeToKeep;
     ConnectionFactory = connectionFactory;
 }
예제 #20
0
 public void Add(Stream stream, GetTimeToKeep timeToKeep = null, Action cleanup = null, IReadOnlyDictionary <string, string> metadata = null)
 {
     Add("default", stream, timeToKeep, cleanup, metadata);
 }
예제 #21
0
 public void AddBytes(Func <Task <byte[]> > bytesFactory, GetTimeToKeep timeToKeep = null, Action cleanup = null, IReadOnlyDictionary <string, string> metadata = null)
 {
     AddBytes("default", bytesFactory, timeToKeep, cleanup, metadata);
 }
예제 #22
0
 public void Add <T>(Func <Task <T> > streamFactory, GetTimeToKeep timeToKeep = null, Action cleanup = null, IReadOnlyDictionary <string, string> metadata = null)
     where T : Stream
 {
     Add("default", streamFactory, timeToKeep, cleanup, metadata);
 }
 public SendBehavior(IPersister persister, GetTimeToKeep timeToKeep)
 {
     this.persister     = persister;
     endpointTimeToKeep = timeToKeep;
 }
예제 #24
0
 internal AttachmentSettings(string fileShare, GetTimeToKeep timeToKeep)
 {
     Guard.AgainstNullOrEmpty(fileShare, nameof(fileShare));
     FileShare  = fileShare;
     TimeToKeep = timeToKeep;
 }