コード例 #1
0
        public Worker(IErrorTracker errorTracker,
                      IReceiveMessages receiveMessages,
                      IActivateHandlers activateHandlers,
                      IStoreSubscriptions storeSubscriptions,
                      ISerializeMessages serializeMessages,
                      IStoreSagaData storeSagaData,
                      IInspectHandlerPipeline inspectHandlerPipeline,
                      string workerThreadName,
                      IHandleDeferredMessage handleDeferredMessage,
                      IMutateIncomingMessages mutateIncomingMessages,
                      IStoreTimeouts storeTimeouts,
                      IEnumerable <IUnitOfWorkManager> unitOfWorkManagers,
                      ConfigureAdditionalBehavior configureAdditionalBehavior,
                      MessageLogger messageLogger)
        {
            this.receiveMessages             = receiveMessages;
            this.serializeMessages           = serializeMessages;
            this.mutateIncomingMessages      = mutateIncomingMessages;
            this.unitOfWorkManagers          = unitOfWorkManagers;
            this.configureAdditionalBehavior = configureAdditionalBehavior;
            this.messageLogger               = messageLogger;
            this.errorTracker                = errorTracker;
            dispatcher                       = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage, storeTimeouts);
            dispatcher.UncorrelatedMessage  += RaiseUncorrelatedMessage;
            nullMessageReceivedBackoffHelper = CreateBackoffHelper(configureAdditionalBehavior.BackoffBehavior);

            workerThread = new Thread(MainLoop)
            {
                Name = workerThreadName
            };
            workerThread.Start();

            log.Info("Worker {0} created and inner thread started", WorkerThreadName);
        }
コード例 #2
0
        /// <summary>
        /// Scans the dlls and creates a dictionary in which each message in IFunctions is referenced to each function.
        /// </summary>
        public HandlersContainer(string serviceName, bool lockSaga = true)
        {
            lock (o)
            {
                this.serviceName = serviceName;

                this.lockSaga = SettingsUtil.HasSettings(SETTINGS.LOCKSAGAS)? SettingsUtil.GetSettings <bool>(SETTINGS.LOCKSAGAS):lockSaga;

                AddDependency <ISerializeMessages, JSONSerializer>();
                AddDependency <ISagaLocker, SagaAzureStorageLocker>();
                AddDependency <ISendMessages, AzureStorageQueueSendTransport>(SolveDependency <ISerializeMessages>());
                AddDependency <IPublishEvents, AzureEventHubPublishTransport>(SolveDependency <ISerializeMessages>());

                this.serializer = SolveDependency <ISerializeMessages>();
                this.sagaLocker = SolveDependency <ISagaLocker>();
                AddDependency <ISagaStoragePersistence, SagaAzureStoragePersistence>(this.sagaLocker as ISagaLocker, this.lockSaga);

                sagaPersistence = SolveDependency <ISagaStoragePersistence>();
                messageSender   = SolveDependency <ISendMessages>();

                var assemblies = new List <Assembly>();

                assemblies.Add(Assembly.GetCallingAssembly());
                assemblies.AddRange(Assembly.GetCallingAssembly().GetReferencedAssemblies().Select(a => Assembly.Load(a.FullName)));

                var types = assemblies.SelectMany(a => a.GetTypes());

                LookForSagas(types);

                LookForHandlers(types);

                this.sagaLocker.CreateLocksContainer();
                sagaPersistence.CreateSagaPersistenceTableAsync().Wait();
            }
        }
コード例 #3
0
ファイル: ChannelBase.cs プロジェクト: cbaxter/InfinityMQ
        protected ChannelBase(ICreateEndpoints endpointFactory, ISerializeMessages messageSerializer)
        {
            Verify.NotNull(messageSerializer, "messageSerializer");

            this.endpointFactory = endpointFactory;
            this.messageSerializer = messageSerializer;
        }
コード例 #4
0
 public MsmqReceiverEndpoint(
     MsmqConnector inputQueue, MsmqConnector poisonQueue, ISerializeMessages serializer)
 {
     this.inputQueue = inputQueue;
     this.poisonQueue = poisonQueue;
     this.serializer = serializer;
 }
コード例 #5
0
ファイル: Worker.cs プロジェクト: rasmuskl/Rebus
        public Worker(IErrorTracker errorTracker,
                      IReceiveMessages receiveMessages,
                      IActivateHandlers activateHandlers,
                      IStoreSubscriptions storeSubscriptions,
                      ISerializeMessages serializeMessages,
                      IStoreSagaData storeSagaData,
                      IInspectHandlerPipeline inspectHandlerPipeline,
                      string workerThreadName,
                      IHandleDeferredMessage handleDeferredMessage,
                      IMutateIncomingMessages mutateIncomingMessages)
        {
            this.receiveMessages        = receiveMessages;
            this.serializeMessages      = serializeMessages;
            this.mutateIncomingMessages = mutateIncomingMessages;
            this.errorTracker           = errorTracker;
            dispatcher = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage);
            dispatcher.UncorrelatedMessage += RaiseUncorrelatedMessage;

            workerThread = new Thread(MainLoop)
            {
                Name = workerThreadName
            };
            workerThread.Start();

            log.Info("Worker {0} created and inner thread started", WorkerThreadName);
        }
コード例 #6
0
 public SqlTimeoutStorage(ISerializeObjects objectSerializer, ISerializeMessages messageSerializer)
 {
     this.objectSerializer = objectSerializer;
     this.messageSerializer = messageSerializer;
     connectionString = Settings.GetSetting(SqlTransportConfiguration.MessagingConnectionStringKey);
     CreateTableIfNecessary();
 }
コード例 #7
0
 public MsmqReceiverEndpoint(
     MsmqConnector inputQueue, MsmqConnector poisonQueue, ISerializeMessages serializer)
 {
     this.inputQueue  = inputQueue;
     this.poisonQueue = poisonQueue;
     this.serializer  = serializer;
 }
コード例 #8
0
        public MessageReader(FrameReader frameReader, ISerializeMessages serializer)
        {
            Verify.NotNull(frameReader, "frameReader");
            Verify.NotNull(serializer, "serializer");

            this.frameReader = frameReader;
            this.serializer = serializer;
        }
コード例 #9
0
ファイル: Bus.cs プロジェクト: AdrianFreemantle/Hermes
 public Bus(ISerializeMessages messageSerializer, ITransportMessages messageTransport, IRouteMessageToEndpoint messageRouter, IPublishMessages messagePublisher, IProcessMessages messageProcessor)
 {
     this.messageSerializer = messageSerializer;
     this.messageTransport = messageTransport;
     this.messageRouter = messageRouter;
     this.messagePublisher = messagePublisher;
     this.messageProcessor = messageProcessor;
 }
コード例 #10
0
        public EncryptMessageSerializer(ISerializeMessages inner, byte[] encryptionKey)
        {
            if (!KeyIsValid(encryptionKey, KeyLength))
            {
                throw new ArgumentException(Diagnostics.InvalidEncryptionKey, "encryptionKey");
            }

            this.encryptionKey = encryptionKey;
            this.inner         = inner;
        }
コード例 #11
0
        public AzureStorageQueueSendTransport(ISerializeMessages serializer)
        {
            this.serializer = serializer;

            // Create a container
            if (!containerCreated)
            {
                var cloudBlobContainer = cloudBlobClient.GetContainerReference(CONTAINER_NAME.ToLower());
                cloudBlobContainer.CreateIfNotExistsAsync().Wait();
                containerCreated = true;
            }
        }
コード例 #12
0
        /// <summary>
        /// Constructs the bus with the specified ways of achieving its goals.
        /// </summary>
        /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param>
        /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param>
        /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param>
        /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param>
        /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param>
        /// <param name="determineDestination">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param>
        /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param>
        /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param>
        public RebusBus(IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, IDetermineDestination determineDestination, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline)
        {
            this.activateHandlers       = activateHandlers;
            this.sendMessages           = sendMessages;
            this.receiveMessages        = receiveMessages;
            this.storeSubscriptions     = storeSubscriptions;
            this.determineDestination   = determineDestination;
            this.serializeMessages      = serializeMessages;
            this.storeSagaData          = storeSagaData;
            this.inspectHandlerPipeline = inspectHandlerPipeline;

            rebusId = Interlocked.Increment(ref rebusIdCounter);

            log.Info("Rebus bus created");
        }
コード例 #13
0
        public static async Task PublishAsync <T>(T input, string topic, ISerializeMessages serializer = null, IPublishEvents publisher = null) where T : class
        {
            serializer = serializer ?? new JSONSerializer();

            var newContext = new AFBusMessageContext
            {
                MessageID     = Guid.NewGuid(),
                TransactionID = Guid.NewGuid(),
                BodyType      = typeof(T).AssemblyQualifiedName
            };

            publisher = publisher ?? new AzureEventHubPublishTransport(serializer);


            await publisher.PublishEventsAsync(input, topic, newContext).ConfigureAwait(false);
        }
コード例 #14
0
ファイル: MessageBus.cs プロジェクト: eyusky/nginn-messagebus
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="transport">Message transport used as a backend for this message bus</param>
 public MessageBus(IMessageTransport transport, IMessageDispatcher dispatcher, ISerializeMessages serializer, IServiceResolver serviceResolver)
 {
     log = LogManager.GetLogger("BUS_" + transport.Endpoint);
     log.Info("Message Bus {0} created", transport.Endpoint);
     MessageSerializer            = serializer;
     Dispatcher                   = dispatcher;
     ServiceLocator               = serviceResolver;
     _transport                   = transport;
     _transport.OnMessageArrived += new MessageArrived(_transport_OnMessageArrived);
     _transport.OnMessageToUnknownDestination += new MessageArrived(_transport_OnMessageToUnknownDestination);
     SubscriptionService = new DummySubscriptionService();
     BatchOutgoingMessagesInTransaction   = true;
     MessageHandlerTransactionScopeOption = TransactionScopeOption.Required;
     UseTransactionScope         = true;
     DefaultSubscriptionLifetime = TimeSpan.FromHours(48);
     PublishLocalByDefault       = true;
 }
コード例 #15
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="transport">Message transport used as a backend for this message bus</param>
 public MessageBus(IMessageTransport transport, IMessageDispatcher dispatcher, ISerializeMessages serializer, IServiceResolver serviceResolver)
 {
     log = LogManager.GetLogger("BUS_" + transport.Endpoint);
     log.Info("Message Bus {0} created", transport.Endpoint);
     MessageSerializer = serializer;
     Dispatcher = dispatcher;
     ServiceLocator = serviceResolver;
     _transport = transport;
     _transport.OnMessageArrived += new MessageArrived(_transport_OnMessageArrived);
     _transport.OnMessageToUnknownDestination += new MessageArrived(_transport_OnMessageToUnknownDestination);
     SubscriptionService = new DummySubscriptionService();
     BatchOutgoingMessagesInTransaction = true;
     MessageHandlerTransactionScopeOption = TransactionScopeOption.Required;
     UseTransactionScope = true;
     DefaultSubscriptionLifetime = TimeSpan.FromHours(48);
     PublishLocalByDefault = true;
 }
コード例 #16
0
        /// <summary>
        /// Constructs the bus with the specified ways of achieving its goals.
        /// </summary>
        /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param>
        /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param>
        /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param>
        /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param>
        /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param>
        /// <param name="determineDestination">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param>
        /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param>
        /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param>
        /// <param name="errorTracker">Will be used to track failed delivery attempts.</param>
        public RebusBus(IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData, IDetermineDestination determineDestination, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline, IErrorTracker errorTracker)
        {
            this.activateHandlers       = activateHandlers;
            this.sendMessages           = sendMessages;
            this.receiveMessages        = receiveMessages;
            this.storeSubscriptions     = storeSubscriptions;
            this.determineDestination   = determineDestination;
            this.serializeMessages      = serializeMessages;
            this.storeSagaData          = storeSagaData;
            this.inspectHandlerPipeline = inspectHandlerPipeline;
            this.errorTracker           = errorTracker;

            batch   = new RebusBatchOperations(determineDestination, storeSubscriptions, this);
            routing = new RebusRouting(this);

            rebusId = Interlocked.Increment(ref rebusIdCounter);

            log.Info("Rebus bus created");
        }
コード例 #17
0
        /// <summary>
        /// Constructs the bus with the specified ways of achieving its goals.
        /// </summary>
        /// <param name="activateHandlers">The bus will use this to construct handlers for received messages.</param>
        /// <param name="sendMessages">Will be used to send transport messages when you send, publish, and reply.</param>
        /// <param name="receiveMessages">Will be used to receive transport messages. If the bus is configured to run with multiple threads, this one should be reentrant.</param>
        /// <param name="storeSubscriptions">Will be used to store subscription information. Is only relevant if the bus is a publisher, i.e. it publishes messages and other services assume they can subscribe to its messages.</param>
        /// <param name="storeSagaData">Will be used to store saga data. Is only relevant if one or more handlers are derived from <see cref="Saga"/>.</param>
        /// <param name="determineMessageOwnership">Will be used to resolve a destination in cases where the message destination is not explicitly specified as part of a send/subscribe operation.</param>
        /// <param name="serializeMessages">Will be used to serialize and deserialize transport messages.</param>
        /// <param name="inspectHandlerPipeline">Will be called to inspect the pipeline of handlers constructed to handle an incoming message.</param>
        /// <param name="errorTracker">Will be used to track failed delivery attempts.</param>
        /// <param name="storeTimeouts">Optionally provides an internal timeout manager to be used instead of sending timeout requests to an external timeout manager</param>
        /// <param name="configureAdditionalBehavior"></param>
        public RebusBus(
            IActivateHandlers activateHandlers, ISendMessages sendMessages, IReceiveMessages receiveMessages, IStoreSubscriptions storeSubscriptions, IStoreSagaData storeSagaData,
            IDetermineMessageOwnership determineMessageOwnership, ISerializeMessages serializeMessages, IInspectHandlerPipeline inspectHandlerPipeline, IErrorTracker errorTracker,
            IStoreTimeouts storeTimeouts, ConfigureAdditionalBehavior configureAdditionalBehavior)
        {
            this.activateHandlers            = activateHandlers;
            this.sendMessages                = sendMessages;
            this.receiveMessages             = receiveMessages;
            this.storeSubscriptions          = storeSubscriptions;
            this.determineMessageOwnership   = determineMessageOwnership;
            this.serializeMessages           = serializeMessages;
            this.storeSagaData               = storeSagaData;
            this.inspectHandlerPipeline      = inspectHandlerPipeline;
            this.errorTracker                = errorTracker;
            this.storeTimeouts               = storeTimeouts;
            this.configureAdditionalBehavior = configureAdditionalBehavior;

            batch   = new RebusBatchOperations(determineMessageOwnership, storeSubscriptions, this);
            routing = new RebusRouting(this);

            rebusId       = Interlocked.Increment(ref rebusIdCounter);
            continuations = new RebusSynchronizationContext();

            log.Info("Rebus bus {0} created", rebusId);

            if (storeTimeouts == null)
            {
                var timeoutManagerEndpointAddress = RebusConfigurationSection
                                                    .GetConfigurationValueOrDefault(s => s.TimeoutManagerAddress, "rebus.timeout");

                log.Info("Using external timeout manager with input queue '{0}'", timeoutManagerEndpointAddress);
                timeoutManagerAddress = timeoutManagerEndpointAddress;
            }
            else
            {
                log.Info("Using internal timeout manager");
                timeoutManagerAddress = this.receiveMessages.InputQueueAddress;
                dueTimeoutScheduler   = new DueTimeoutScheduler(storeTimeouts, new DeferredMessageReDispatcher(this));
            }
        }
コード例 #18
0
ファイル: Worker.cs プロジェクト: pruiz/Rebus
        public Worker(
            IErrorTracker errorTracker,
            IReceiveMessages receiveMessages,
            IActivateHandlers activateHandlers,
            IStoreSubscriptions storeSubscriptions,
            ISerializeMessages serializeMessages,
            IStoreSagaData storeSagaData,
            IInspectHandlerPipeline inspectHandlerPipeline,
            string workerThreadName,
            IHandleDeferredMessage handleDeferredMessage,
            IMutateIncomingMessages mutateIncomingMessages,
            IStoreTimeouts storeTimeouts,
            IEnumerable<IUnitOfWorkManager> unitOfWorkManagers,
            ConfigureAdditionalBehavior configureAdditionalBehavior,
            MessageLogger messageLogger,
            RebusSynchronizationContext continuations)
        {
            this.receiveMessages = receiveMessages;
            this.serializeMessages = serializeMessages;
            this.mutateIncomingMessages = mutateIncomingMessages;
            this.unitOfWorkManagers = unitOfWorkManagers;
            this.configureAdditionalBehavior = configureAdditionalBehavior;
            this.messageLogger = messageLogger;
            this.continuations = continuations;
            this.errorTracker = errorTracker;
            dispatcher = new Dispatcher(storeSagaData, activateHandlers, storeSubscriptions, inspectHandlerPipeline, handleDeferredMessage, storeTimeouts);
            dispatcher.UncorrelatedMessage += RaiseUncorrelatedMessage;
            nullMessageReceivedBackoffHelper = CreateBackoffHelper(configureAdditionalBehavior.BackoffBehavior);

            workerThread = new Thread(MainLoop) { Name = workerThreadName };
            workerThread.Start();

            log.Info("Worker {0} created and inner thread started", WorkerThreadName);
        }
コード例 #19
0
 public virtual SerializationWireup XmlSerializer()
 {
     this.messageSerializer = new XmlMessageSerializer();
     return this;
 }
コード例 #20
0
 public virtual SerializationWireup BinarySerializer()
 {
     this.messageSerializer = new BinaryMessageSerializer();
     return this;
 }
コード例 #21
0
 /// <summary>
 /// Uses the specified implementation of <see cref="ISerializeMessages"/> to serialize transport messages
 /// </summary>
 public void Use(ISerializeMessages serializer)
 {
     Backbone.SerializeMessages = serializer;
 }
コード例 #22
0
ファイル: Bus.cs プロジェクト: QEhquezada/Azure-Functions-Bus
 internal Bus(ISerializeMessages serializer, ISendMessages sender, IPublishEvents publisher)
 {
     this.serializer = serializer;
     this.sender     = sender;
     this.publisher  = publisher;
 }
コード例 #23
0
 public virtual SerializationWireup JsonSerializer()
 {
     this.messageSerializer = new JsonMessageSerializer();
     return this;
 }
コード例 #24
0
 public AzureStorageQueueSendTransport(ISerializeMessages serializer)
 {
     this.serializer = serializer;
 }
コード例 #25
0
 public AzureEventHubPublishTransport(ISerializeMessages serializer)
 {
     this.serializer = serializer;
 }
コード例 #26
0
 public AzureStorageQueueSendTransportShortMaxDelay(ISerializeMessages serializer) : base(serializer)
 {
     this.serializer = serializer;
 }
コード例 #27
0
ファイル: ChannelFactory.cs プロジェクト: cbaxter/InfinityMQ
 public ISubscribeToMessages CreateSubscriber(ISerializeMessages messageSerializer)
 {
     return new SubscriberChannel(new EndpointFactory(BufferedFrameReaderFactory.Instance, NullFrameWriterFactory.Instance), messageSerializer);
 }
コード例 #28
0
 public GzipMessageSerializer(ISerializeMessages inner)
 {
     this.inner = inner;
 }
コード例 #29
0
 public GzipMessageSerializer(ISerializeMessages inner)
 {
     this.inner = inner;
 }
コード例 #30
0
 public MessageReceiverForTesting(ISerializeMessages serializer)
 {
     this.serializer = serializer;
 }
コード例 #31
0
 /// <summary>
 /// Uses the specified implementation of <see cref="ISerializeMessages"/> to serialize transport messages
 /// </summary>
 public void Use(ISerializeMessages serializer)
 {
     Backbone.SerializeMessages = serializer;
 }
コード例 #32
0
ファイル: DuplexChannel.cs プロジェクト: cbaxter/InfinityMQ
 public DuplexChannel(ICreateEndpoints endpointFactory, ISerializeMessages messageSerializer)
     : base(endpointFactory, messageSerializer)
 {
 }
コード例 #33
0
 public MessageReceiverForTesting(ISerializeMessages serializer)
 {
     this.serializer = serializer;
 }
コード例 #34
0
 public MsmqSenderEndpoint(Func <Uri, MsmqConnector> connectorFactory, ISerializeMessages serializer)
 {
     this.connectorFactory = connectorFactory;
     this.serializer       = serializer;
 }
コード例 #35
0
 public SubscriberChannel(ICreateEndpoints endpointFactory, ISerializeMessages messageSerializer)
     : base(endpointFactory, messageSerializer)
 {
 }
コード例 #36
0
 public virtual SerializationWireup ProtocolBufferSerializer(params Type[] messageTypes)
 {
     this.messageSerializer = new ProtocolBufferSerializer(messageTypes);
     return this;
 }
コード例 #37
0
ファイル: ChannelFactory.cs プロジェクト: cbaxter/InfinityMQ
 public ISendMessages CreateSender(ISerializeMessages messageSerializer)
 {
     return new DuplexChannel(new EndpointFactory(DefaultFrameReaderFactory.Instance, DefaultFrameWriterFactory.Instance), messageSerializer);
 }
コード例 #38
0
 public MsmqSenderEndpoint(Func<Uri, MsmqConnector> connectorFactory, ISerializeMessages serializer)
 {
     this.connectorFactory = connectorFactory;
     this.serializer = serializer;
 }
コード例 #39
0
ファイル: ChannelFactory.cs プロジェクト: cbaxter/InfinityMQ
 public IPublishMessages CreatePublisher(ISerializeMessages messageSerializer)
 {
     return new PublisherChannel(new EndpointFactory(NullFrameReaderFactory.Instance, BufferedFrameWriterFactory.Instance), messageSerializer);
 }
コード例 #40
0
 public TransformationMessageSerializer(ISerializeMessages inner, ITransformMessages transformer)
 {
     this.transformer = transformer;
     this.inner       = inner;
 }
コード例 #41
0
 public TransformationMessageSerializer(ISerializeMessages inner, ITransformMessages transformer)
 {
     this.transformer = transformer;
     this.inner = inner;
 }
コード例 #42
0
 public virtual SerializationWireup CustomSerializer(ISerializeMessages serializer)
 {
     this.messageSerializer = serializer;
     return this;
 }
コード例 #43
0
 public virtual SerializationWireup XmlSerializer()
 {
     this.messageSerializer = new XmlMessageSerializer();
     return(this);
 }
コード例 #44
0
        /// <summary>
        /// Sends a message to a queue named like the service.
        /// </summary>
        public static async Task SendAsync <T>(T input, string serviceName, TimeSpan?initialVisibilityDelay = null, ISerializeMessages serializer = null, ISendMessages sender = null) where T : class
        {
            serializer = serializer ?? new JSONSerializer();
            sender     = sender ?? new AzureStorageQueueSendTransport(serializer);

            var context = new AFBusMessageContext
            {
                MessageID     = Guid.NewGuid(),
                TransactionID = Guid.NewGuid(),
                BodyType      = typeof(T).AssemblyQualifiedName
            };

            if (initialVisibilityDelay != null)
            {
                context.MessageDelayedTime          = initialVisibilityDelay.Value;
                context.MessageFinalWakeUpTimeStamp = DateTime.UtcNow + initialVisibilityDelay;
            }

            await sender.SendMessageAsync(input, serviceName, context).ConfigureAwait(false);
        }
コード例 #45
0
 public virtual SerializationWireup CustomSerializer(ISerializeMessages serializer)
 {
     this.messageSerializer = serializer;
     return(this);
 }
コード例 #46
0
 public virtual SerializationWireup BinarySerializer()
 {
     this.messageSerializer = new BinaryMessageSerializer();
     return(this);
 }
コード例 #47
0
 public AzureServiceBusPublishTransport(ISerializeMessages serializer)
 {
     this.serializer = serializer;
 }