public override IServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse> CreateEndpoint()
 {
     return(new ServiceEndpoint <TMessage, TCommand, TEvent, TRequest, TResponse>(
                new MessageSource <TRequest>(_requestAddress, _deserializerFactory.Create <TRequest, TServiceMessage>(_assemblyFilter, _typeFilter), RequestsDestination),
                new MessageSource <TCommand>(_commandAddress, _deserializerFactory.Create <TCommand, TServiceMessage>(_assemblyFilter, _typeFilter), CommandsDestination),
                new MessagePublisher <TEvent>(_eventAddress, _serializer, EventsDestination),
                new MessagePublisher <TResponse>(_responseAddress, _serializer, ResponsesDestination),
                typeof(TServiceMessage)));
 }
示例#2
0
        private IMessageSource <T> CreateSource <T>(Lazy <IConnection> connection, string destination) where T : class, TMessage
        {
            List <Tuple <Type, AcknowledgementMode> > queueTypes;
            var acknowledgementMode = GetAcknowledgementMode <T>();

            if (TryGetMultipleQueueTypes <T>(out queueTypes))
            {
                var deserializers = _deserializerFactory.Create <T, TServiceMessage>(_assemblyFilter, _typeFilter).ToArray();
                var topicSources  = new[]
                {
                    new MessageSource <T>(connection, deserializers, new ActiveMQTopic(destination),
                                          acknowledgementMode, _selector, _propertyFilter, _noLocal)
                };
                var queueSources = queueTypes.Select(qt =>
                                                     new MessageSource <T>(connection,
                                                                           deserializers,
                                                                           new ActiveMQQueue(GetTypedQueueName(destination, qt.Item1)),
                                                                           qt.Item2,
                                                                           _selector,
                                                                           _propertyFilter,
                                                                           _noLocal));

                return(new MergedMessageSource <T>(topicSources.Concat(queueSources)));
            }

            return(DestinationFactory.CreateSource <T, TServiceMessage>(connection, destination, GetDestinationType <T>(),
                                                                        _deserializerFactory, _propertyFilter, _assemblyFilter, _typeFilter, _selector,
                                                                        acknowledgementMode, _noLocal));
        }
示例#3
0
 public static MessageSource <TMessage> CreateSource <TMessage, TServiceMessage>(string brokerUri, string routingKeyPrefix, string serviceName, IMessageDeserializerFactory deserializerFactory, Lazy <IConnection> connection, Func <Assembly, bool> assemblyFilter = null, Func <Type, bool> typeFilter = null, string selector = null)
     where TServiceMessage : class
     where TMessage : class
 {
     return(new MessageSource <TMessage>(
                connection,
                deserializerFactory.Create <TMessage, TServiceMessage>(assemblyFilter, typeFilter),
                serviceName,
                routingKeyPrefix));
 }
示例#4
0
 public static MessageSource <TMessage> Create <TMessage, TServiceMessage>(Lazy <IEventStoreConnection> lazyConnection, string streamName, IMessageDeserializerFactory deserializerFactory,
                                                                           Func <Dictionary <string, string>, bool> propertyFilter, Func <Assembly, bool> assemblyFilter = null, Func <Type, bool> typeFilter = null)
     where TMessage : class
     where TServiceMessage : class
 {
     return(new MessageSource <TMessage>(
                lazyConnection,
                streamName,
                deserializerFactory.Create <TMessage, TServiceMessage>(assemblyFilter, typeFilter),
                propertyFilter));
 }
        /// <inheritdoc />
        private IMessageSource <TSourceMessage> CreateSource <TSourceMessage>(
            CloudQueueClient cloudQueueClient,
            string messageCategory
            ) where TSourceMessage : class, TMessage
        {
            var sourceMessageType = typeof(TSourceMessage);
            var queueName         = GetQueueName <TSourceMessage>(_serviceName, DEFAULT_REQUESTS_QUEUE_SUFFIX);
            var cloudQueue        = cloudQueueClient.GetQueueReference(queueName);
            var deserializers     = _deserializerFactory.Create <TSourceMessage, TServiceMessage>().ToList();

            return(new MessageSource <TSourceMessage>(
                       cloudQueue,
                       deserializers,
                       _queueRequestOptionsByMessageType,
                       _maxMessagesToDequeue));
        }
示例#6
0
 public static MessageSource <TMessage> Create <TMessage, TServiceMessage>(
     KafkaConfiguration kafkaConfiguration,
     KafkaSourceConfiguration sourceConfiguration,
     string topic,
     IMessageDeserializerFactory deserializerFactory,
     Func <Dictionary <string, string>, bool> propertyFilter,
     Func <Assembly, bool> assemblyFilter = null,
     Func <Type, bool> typeFilter         = null)
     where TMessage : class
     where TServiceMessage : class
 {
     return(new MessageSource <TMessage>(
                kafkaConfiguration,
                sourceConfiguration,
                topic,
                deserializerFactory.Create <TMessage, TServiceMessage>(assemblyFilter, typeFilter),
                propertyFilter));
 }
 public static MessageSource <TMessage> CreateSource <TMessage, TServiceMessage>(
     Lazy <IConnection> lazyConnection,
     string destination,
     DestinationType destinationType,
     IMessageDeserializerFactory deserializerFactory,
     Func <IDictionary, bool> propertyFilter,
     Func <Assembly, bool> assemblyFilter = null,
     Func <Type, bool> typeFilter         = null,
     string selector          = null,
     AcknowledgementMode mode = AcknowledgementMode.AutoAcknowledge)
     where TMessage : class
     where TServiceMessage : class
 {
     return(new MessageSource <TMessage>(
                lazyConnection,
                deserializerFactory.Create <TMessage, TServiceMessage>(assemblyFilter, typeFilter),
                CreateDestination(destination, destinationType),
                mode, selector, propertyFilter));
 }
 private IMessageSource <T> CreateSource <T>(Lazy <IConnection> connection, string subject) where T : class, TMessage
 {
     return(new MessageSource <T>(connection, subject,
                                  _deserializerFactory.Create <T, TServiceMessage>(_assemblyFilter, _typeFilter),
                                  _propertyFilter));
 }