Beispiel #1
0
        /// <summary>
        /// Configures Rebus to use the file system to transport messages. The specified <paramref name="baseDirectory"/> will be used as the base directory
        /// within which subdirectories will be created for each logical queue.
        /// </summary>
        public static FileSystemTransportOptions UseFileSystem(this StandardConfigurer <ITransport> configurer, string baseDirectory, string inputQueueName)
        {
            if (baseDirectory == null)
            {
                throw new ArgumentNullException(nameof(baseDirectory));
            }
            if (inputQueueName == null)
            {
                throw new ArgumentNullException(nameof(inputQueueName));
            }

            var options = new FileSystemTransportOptions();

            configurer
            .OtherService <FileSystemTransport>()
            .Register(context => new FileSystemTransport(baseDirectory, inputQueueName, options, context.Get <IRebusTime>()));

            configurer
            .OtherService <ITransportInspector>()
            .Register(c => c.Get <FileSystemTransport>());

            configurer.Register(context => context.Get <FileSystemTransport>());

            return(options);
        }
Beispiel #2
0
        /// <summary>
        /// Configures Rebus to use the file system to transport messages. The specified <paramref name="baseDirectory"/> will be used as the base directory
        /// within which subdirectories will be created for each logical queue.
        /// </summary>
        public static FileSystemTransportOptions UseFileSystem(this StandardConfigurer <ITransport> configurer, string baseDirectory, string inputQueueName)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                throw new PlatformNotSupportedException(
                          "Since file lock currently cannot be created safely in C# on linux, this FileSystemTransport is not supported");
            }
            if (baseDirectory == null)
            {
                throw new ArgumentNullException(nameof(baseDirectory));
            }
            if (inputQueueName == null)
            {
                throw new ArgumentNullException(nameof(inputQueueName));
            }

            var options = new FileSystemTransportOptions();

            configurer
            .OtherService <FileSystemTransport>()
            .Register(context => new FileSystemTransport(baseDirectory, inputQueueName, options, context.Get <IRebusTime>()));

            configurer
            .OtherService <ITransportInspector>()
            .Register(c => c.Get <FileSystemTransport>());

            configurer.Register(context => context.Get <FileSystemTransport>());

            return(options);
        }
Beispiel #3
0
 /// <summary>
 /// Creates the transport using the given <paramref name="baseDirectory"/> to store messages in the form of JSON files
 /// </summary>
 public FileSystemTransport(string baseDirectory, string inputQueueName, FileSystemTransportOptions options, IRebusTime rebusTime)
 {
     _baseDirectory = baseDirectory ?? throw new ArgumentNullException(nameof(baseDirectory));
     _options       = options ?? throw new ArgumentNullException(nameof(options));
     _rebusTime     = rebusTime ?? throw new ArgumentNullException(nameof(rebusTime));
     Address        = inputQueueName;
 }