public RedisMessageProducerSendTests()
        {
            var configuration = new RedisMessagingGatewayConfiguration
            {
                ServerList     = "localhost",
                AllowAdmin     = false,
                ConnectRetry   = 3,
                ConnectTimeout = 5000,
                Proxy          = Proxy.None,
                SyncTimeout    = 1000
            };

            var options = ConfigurationOptions.Parse(configuration.ServerList);

            options.AllowAdmin     = configuration.AllowAdmin;
            options.ConnectRetry   = configuration.ConnectRetry;
            options.ConnectTimeout = configuration.ConnectTimeout;
            options.SyncTimeout    = configuration.SyncTimeout;
            options.Proxy          = configuration.Proxy;
            var connectionMultiplexer = ConnectionMultiplexer.Connect(options);

            _messageProducer = new RedisMessageProducer(connectionMultiplexer);
            _messageConsumer = new RedisMessageConsumer(connectionMultiplexer, QueueName, Topic);
            _message         = new Message(new MessageHeader(Guid.NewGuid(), Topic, MessageType.MT_COMMAND), new MessageBody("test content"));
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var container = new TinyIoCContainer();

            var messageMapperFactory = new TinyIoCMessageMapperFactory(container);

            var messageMapperRegistry = new MessageMapperRegistry(messageMapperFactory)
            {
                { typeof(GreetingEvent), typeof(GreetingEventMessageMapper) }
            };

            var outbox          = new InMemoryOutbox();
            var redisConnection = new RedisMessagingGatewayConfiguration
            {
                RedisConnectionString = "localhost:6379?connectTimeout=1&sendTImeout=1000&",
                MaxPoolSize           = 10,
                MessageTimeToLive     = TimeSpan.FromMinutes(10)
            };

            var producer = new RedisMessageProducer(redisConnection);

            var builder = CommandProcessorBuilder.With()
                          .Handlers(new HandlerConfiguration())
                          .DefaultPolicy()
                          .TaskQueues(new MessagingConfiguration(outbox, producer, messageMapperRegistry))
                          .RequestContextFactory(new InMemoryRequestContextFactory());

            var commandProcessor = builder.Build();

            commandProcessor.Post(new GreetingEvent("Ian"));
        }
コード例 #3
0
 public static void SendMessage <T>(T message)
 {
     using (var cli = new RedisMessageProducer(_redisManager))
     {
         cli.Publish(message);
     }
 }
コード例 #4
0
        public RedisFixture()
        {
            RedisMessagingGatewayConfiguration configuration = RedisMessagingGatewayConfiguration();

            MessageProducer = new RedisMessageProducer(configuration);
            MessageConsumer = new RedisMessageConsumer(configuration, QueueName, Topic);
        }
コード例 #5
0
 public EbBaseNewController(IServiceClient _ssclient, IRedisClient _redis, IMessageQueueClient _mqFactory, IMessageProducer _mqProducer)
 {
     this.ServiceClient           = _ssclient as JsonServiceClient;
     this.Redis                   = _redis as RedisClient;
     this.RedisMessageQueueClient = _mqFactory as RedisMessageQueueClient;
     this.RedisMessageProducer    = _mqProducer as RedisMessageProducer;
 }
コード例 #6
0
        private static void Main(string[] args)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .Enrich.FromLogContext()
                         .WriteTo.Console()
                         .CreateLogger();

            var serviceCollection = new ServiceCollection();

            var redisConnection = new RedisMessagingGatewayConfiguration
            {
                RedisConnectionString = "localhost:6379?connectTimeout=1&sendTimeout=1000&",
                MaxPoolSize           = 10,
                MessageTimeToLive     = TimeSpan.FromMinutes(10)
            };
            var producer = new RedisMessageProducer(redisConnection);

            serviceCollection.AddBrighter(options =>
            {
                var outBox = new InMemoryOutbox();
                options.BrighterMessaging = new BrighterMessaging(outBox, outBox, producer, null);
            }).AutoFromAssemblies();

            var serviceProvider = serviceCollection.BuildServiceProvider();

            var commandProcessor = serviceProvider.GetService <IAmACommandProcessor>();

            commandProcessor.Post(new GreetingEvent("Ian"));
        }
        public RedisMessageProducerSendTests()
        {
            var configuration = new RedisMessagingGatewayConfiguration
            {
                RedisConnectionString = "localhost:6379?connectTimeout=1&sendTImeout=1000&",
                MaxPoolSize           = 10,
                MessageTimeToLive     = TimeSpan.FromMinutes(10)
            };

            _messageProducer = new RedisMessageProducer(configuration);
            _messageConsumer = new RedisMessageConsumer(configuration, QueueName, Topic);
            _message         = new Message(
                new MessageHeader(Guid.NewGuid(), Topic, MessageType.MT_COMMAND),
                new MessageBody("test content")
                );
        }
        public RedisMessageProducerSendTests()
        {
            var configuration = new RedisMessagingGatewayConfiguration
            {
                ServerList     = "localhost",
                AllowAdmin     = false,
                ConnectRetry   = 3,
                ConnectTimeout = 5000,
                Proxy          = Proxy.None,
                SyncTimeout    = 1000
            };

            _messageProducer = new RedisMessageProducer(configuration);
            _messageConsumer = new RedisMessageConsumer(configuration, QueueName, Topic);
            _message         = new Message(new MessageHeader(Guid.NewGuid(), Topic, MessageType.MT_COMMAND), new MessageBody("test content"));
        }
コード例 #9
0
 public EbBaseIntController(IServiceClient _ssclient, IRedisClient _redis, IMessageQueueClient _mqFactory, IMessageProducer _mqProducer)
     : base(_ssclient, _redis)
 {
     this.RedisMessageQueueClient = _mqFactory as RedisMessageQueueClient;
     this.RedisMessageProducer    = _mqProducer as RedisMessageProducer;
 }