Exemple #1
0
 private static SubscriberBase MakeSubscriberEventMessage(MessageBrokerType messageBrokerType)
 {
     return(messageBrokerType switch
     {
         MessageBrokerType.RabbitMq => new SubscriberRabbitMq(),
         var mbt when
         mbt == MessageBrokerType.ServiceBus ||
         mbt == MessageBrokerType.Console => new SubscriberServiceBus(),
         _ => throw new ConfigurationSettingInvalidException($"The Message Broker Type of: {messageBrokerType} is not a valid or supported Message Broker Type")
     });
            MessageBrokerSubscriberBase messageBrokerSubscriber) Create(MessageBrokerType messageBrokerType)
        {
            switch (messageBrokerType)
            {
            case MessageBrokerType.RabbitMq:
                return(
                    new MessageBrokerPublisherRabbitMq(brokerConnectionStringRabbitMq, topicExchange),
                    new MessageBrokerSubscriberRabbitMq(brokerConnectionStringRabbitMq, topicExchange, queueName));
            }

            throw new MessageBrokerTypeNotSupportedException($"The MessageBrokerType: {messageBrokerType}, is not supported yet");
        }
        public static PublisherBase Create(MessageBrokerType messageBrokerType)
        {
            switch (messageBrokerType)
            {
            case MessageBrokerType.RabbitMq:
                return(new PublisherRabbitMq(brokerConnectionStringRabbitMq, titleTopic));

            case MessageBrokerType.ServiceBus:
                return(new PublisherServiceBus(brokerConnectionStringServiceBus, titleTopic));
            }

            throw new MessageBrokerTypeNotSupportedException($"The MessageBrokerType: {messageBrokerType}, is not supported yet");
        }
        public static SubscriberBase Create(MessageBrokerType messageBrokerType)
        {
            SubscriberBase subscriber       = null;
            string         connectionString = null;

            switch (messageBrokerType)
            {
            case MessageBrokerType.RabbitMq:
                subscriber       = new SubscriberRabbitMq();
                connectionString = brokerConnectionStringRabbitMq;
                break;

            case MessageBrokerType.ServiceBus:
                subscriber       = new SubscriberServiceBus();
                connectionString = brokerConnectionStringServiceBus;
                break;

            default:
                throw new MessageBrokerTypeNotSupportedException($"The MessageBrokerType: {messageBrokerType}, is not supported yet");
            }

            subscriber.Initialize(connectionString, commandTopic, commandQueue);
            return(subscriber);
        }
 public MessageBrokerSettings(string messageBrokerConnectionString, MessageBrokerType messageBrokerType)
 {
     MessageBrokerConnectionString = messageBrokerConnectionString;
     MessageBrokerType             = messageBrokerType;
 }