• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# MessagingFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MessagingFactory的典型用法代码示例。如果您正苦于以下问题:C# MessagingFactory类的具体用法?C# MessagingFactory怎么用?C# MessagingFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MessagingFactory类属于命名空间,在下文中一共展示了MessagingFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: given_a_messaging_factory

		public void given_a_messaging_factory()
		{
			mf = TestConfigFactory.CreateMessagingFactory();
			var nm = TestConfigFactory.CreateNamespaceManager(mf);

			nm.TopicExists("my.topic.here").ShouldBeFalse();
		}
开发者ID:haf,项目名称:MassTransit-AzureServiceBus,代码行数:7,代码来源:When_getting_client_for_non_existent_topic.cs


示例2: BrokeredTransport

 public BrokeredTransport(string connectionString, string inputQueueName)
 {
     this.connectionString = connectionString;
     this.inputQueueName = inputQueueName;
     this.factory = MessagingFactory.CreateFromConnectionString(connectionString);
     this.queues = new ConcurrentDictionary<string, QueueClient>();
 }
开发者ID:jamesholcomb,项目名称:NDomain,代码行数:7,代码来源:BrokeredTransport.cs


示例3: ResponseMessagePump

 internal ResponseMessagePump(MessagingFactory messagingFactory, string replyQueueName, RequestResponseCorrelator requestResponseCorrelator, ILogger logger, int batchSize)
     : base(logger, batchSize)
 {
     _messagingFactory = messagingFactory;
     _replyQueueName = replyQueueName;
     _requestResponseCorrelator = requestResponseCorrelator;
 }
开发者ID:Joshscorp,项目名称:Nimbus,代码行数:7,代码来源:ResponseMessagePump.cs


示例4: ServiceBusConnection

        public ServiceBusConnection(ServiceBusScaleoutConfiguration configuration, TraceSource traceSource)
        {
            _trace = traceSource;
            _connectionString = configuration.BuildConnectionString();

            try
            {
                _namespaceManager = NamespaceManager.CreateFromConnectionString(_connectionString);
                _factory = MessagingFactory.CreateFromConnectionString(_connectionString);

                if (configuration.RetryPolicy != null)
                {
                    _factory.RetryPolicy = configuration.RetryPolicy;
                }
                else
                {
                    _factory.RetryPolicy = RetryExponential.Default;
                }
            }
            catch (ConfigurationErrorsException)
            {
                _trace.TraceError("The configured Service Bus connection string contains an invalid property. Check the exception details for more information.");
                throw;
            }

            _backoffTime = configuration.BackoffTime;
            _idleSubscriptionTimeout = configuration.IdleSubscriptionTimeout;    
            _configuration = configuration;
        }
开发者ID:GaneshBachhao,项目名称:SignalR,代码行数:29,代码来源:ServiceBusConnection.cs


示例5: OpenAsync

        public async Task<string> OpenAsync(CancellationToken cancellationToken)
        {
            var builder = new ServiceBusConnectionStringBuilder(_connectionString)
            {
                TransportType = TransportType.Amqp
            };
            _messagingFactory = MessagingFactory.CreateFromConnectionString(builder.ToString());
            _eventHubClient = _messagingFactory.CreateEventHubClient(_eventHubName);
            _consumerGroup = !string.IsNullOrEmpty(_consumerGroupName)
                ? _eventHubClient.GetConsumerGroup(_consumerGroupName)
                : _eventHubClient.GetDefaultConsumerGroup();

            _eventProcessorFactory = new EventProcessorFactory();
            _leaseRepository = new ReliableStateLeaseRepository(_reliableStateManager);
            _checkpointManager = new CheckpointManager(_leaseRepository); 

            var allocatedPartitions = await new EventHubPartitionPartitionAllocationStrategy(_serviceName, _partitionId)
                .AllocateAsync(_eventHubClient, new FabricClient());

            foreach (var partition in allocatedPartitions)
            {
                var lease = await _leaseRepository.GetOrCreateAsync(_connectionString, _consumerGroupName, _eventHubName, partition);

                await _consumerGroup.RegisterProcessorFactoryAsync(lease, _checkpointManager, _eventProcessorFactory);
            }

            return string.Concat(_eventHubName, " @ ", _connectionString);
        }
开发者ID:yvesgoeleven,项目名称:ServiceFabric.IoTSample,代码行数:28,代码来源:EventHubCommunicationListener.cs


示例6: RequestMessagePump

 public RequestMessagePump(MessagingFactory messagingFactory, IRequestBroker requestBroker, Type messageType, ILogger logger)
     : base(logger)
 {
     _messagingFactory = messagingFactory;
     _requestBroker = requestBroker;
     _messageType = messageType;
 }
开发者ID:nblumhardt,项目名称:Nimbus,代码行数:7,代码来源:RequestMessagePump.cs


示例7: AzureMessageConsumer

        protected static void AzureMessageConsumer(MessagingFactory f)
        {
            //use the already created messaging factory to create a msg receiver
            MessageReceiver testQueueReceiver = f.CreateMessageReceiver("colors");

            while (true)
            {
                using (BrokeredMessage retrievedMessage = testQueueReceiver.Receive())
                {

                    try
                    {
                        string msgResult = retrievedMessage.GetBody<string>();

                        //call SP to insert the data into the proper table
                        InsertSQL(msgResult);

                        Console.WriteLine("Message received: " + msgResult);
                        retrievedMessage.Complete();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.ToString());
                        retrievedMessage.Abandon();
                    }
                }
            }
        }
开发者ID:genefrederick,项目名称:ColorStack,代码行数:28,代码来源:Program.cs


示例8: Init

        public async void Init(MessageReceived messageReceivedHandler) {
            this.random = new Random();

            //ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.AutoDetect;
            
            // Tcp mode does not work when I run in a VM (VirtualBox) and the host 
            // is using a wireless connection. Hard coding to Http.
            ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;

            string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
            this.factory = MessagingFactory.CreateFromConnectionString(connectionString);
            this.namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);

            if (!namespaceManager.TopicExists(topicName)) {
                namespaceManager.CreateTopic(topicName);
            }

            this.subscriptionName = Guid.NewGuid().ToString();

            // Not needed really, it's a GUID...
            if (!namespaceManager.SubscriptionExists(topicName, subscriptionName)) {
                namespaceManager.CreateSubscription(topicName, subscriptionName);
            }

            this.topicClient = factory.CreateTopicClient(topicName);

            this.subClient = factory.CreateSubscriptionClient(topicName, subscriptionName);

            while (true) {
                await ReceiveMessageTaskAsync(messageReceivedHandler);
            }
        }
开发者ID:DonKarlssonSan,项目名称:CumulusChat,代码行数:32,代码来源:ChatApplication.cs


示例9: DurableMessageSender

        public DurableMessageSender(MessagingFactory messagingFactory, string serviceBusQueueOrTopicName)
        {
            this.messagingFactory = messagingFactory;
            this.sbusEntityName = serviceBusQueueOrTopicName;

            // Create a Service Bus queue client to send messages to the Service Bus queue.
            this.messageSender = this.messagingFactory.CreateMessageSender(this.sbusEntityName);

            // Create MSMQ queue if it doesn't exit. If it does, open the existing MSMQ queue.
            this.msmqQueueName = MsmqHelper.CreateMsmqQueueName(this.sbusEntityName, "SEND");
            this.msmqQueue = MsmqHelper.GetMsmqQueue(this.msmqQueueName);

            // Create MSMQ deadletter queue if it doesn't exit. If it does, open the existing MSMQ deadletter queue.
            this.msmqDeadletterQueueName = MsmqHelper.CreateMsmqQueueName(this.sbusEntityName, "SEND_DEADLETTER");
            this.msmqDeadletterQueue = MsmqHelper.GetMsmqQueue(this.msmqDeadletterQueueName);

            // Initialize wait time after durable client experienced a transient error.
            timerWaitTimeInMilliseconds = minTimerWaitTimeInMilliseconds;

            // FOR TESTING PURPOSE ONLY.
            this.faultInjector = new FaultInjector(enableFaultInjection);

            // Start receiving messages from the MSMQ queue.
            MsmqPeekBegin();
        }
开发者ID:NorfolkNChance,项目名称:azuretest,代码行数:25,代码来源:DurableSender.cs


示例10: Connect

        public void Connect()
        {
            Disconnect();

            _log.DebugFormat("Connecting '{0}'", _endpointAddress);

            if (_messagingFactory == null)
                _messagingFactory = _endpointAddress.MessagingFactoryFactory();

            // check if it's a queue or a subscription to subscribe either the queue or the subscription?
            if (_endpointAddress.QueueDescription != null)
            {
                _messageSender = _endpointAddress.CreateQueue()
                                                 .ContinueWith(t =>
                                                     {
                                                         t.Wait();
                                                         return
                                                             _messagingFactory.TryCreateMessageSender(
                                                                 _endpointAddress.QueueDescription, _prefetchCount)
                                                                              .Result;
                                                     })
                                                 .Result;
            }
            else
            {
                _messageSender = _messagingFactory.TryCreateMessageSender(_endpointAddress.TopicDescription)
                                                  .Result;
            }

            if (_messageSender == null)
                throw new TransportException(_endpointAddress.Uri,
                    "The create message sender on messaging factory returned null.");
        }
开发者ID:jglozano,项目名称:MassTransit-AzureServiceBus,代码行数:33,代码来源:AzureServiceBusConnection.cs


示例11: ServiceBusListener

 public ServiceBusListener(MessagingFactory messagingFactory, string entityPath, ServiceBusTriggerExecutor triggerExecutor)
 {
     _messagingFactory = messagingFactory;
     _entityPath = entityPath;
     _triggerExecutor = triggerExecutor;
     _cancellationTokenSource = new CancellationTokenSource();
 }
开发者ID:Bjakes1950,项目名称:azure-webjobs-sdk,代码行数:7,代码来源:ServiceBusListener.cs


示例12: ReliableClientBase

 public ReliableClientBase(string sbNamespace, TokenProvider tokenProvider, string path, RetryPolicy<ServiceBusTransientErrorDetectionStrategy> policy)
 {
     mRetryPolicy = policy;
     Uri address = ServiceBusEnvironment.CreateServiceUri("sb", sbNamespace, string.Empty);
     mNamespaceManager = new NamespaceManager(address, tokenProvider);
     mMessagingFactory = MessagingFactory.Create(address, tokenProvider);
 }
开发者ID:HaishiBai,项目名称:ReliableServiceBusClients,代码行数:7,代码来源:ReliableClientBase.cs


示例13: MulticastRequestMessagePump

 public MulticastRequestMessagePump(MessagingFactory messagingFactory, IMulticastRequestBroker multicastRequestBroker, Type requestType, string applicationSharedSubscriptionName, ILogger logger, int batchSize) : base(logger, batchSize)
 {
     _messagingFactory = messagingFactory;
     _multicastRequestBroker = multicastRequestBroker;
     _requestType = requestType;
     _applicationSharedSubscriptionName = applicationSharedSubscriptionName;
 }
开发者ID:nhuhuynh,项目名称:Nimbus,代码行数:7,代码来源:MulticastRequestMessagePump.cs


示例14: ReceiveAllMessagesFromSubscripions

 static void ReceiveAllMessagesFromSubscripions(MessagingFactory messagingFactory)
 {
     // Receive message from 3 subscriptions.
     Program.ReceiveAllMessageFromSubscription(messagingFactory, Conts.SubAllMessages);
     Program.ReceiveAllMessageFromSubscription(messagingFactory, Conts.YoungHorses);
     Program.ReceiveAllMessageFromSubscription(messagingFactory, Conts.OldHorses);
 }
开发者ID:ssuing8825,项目名称:HorseFarm,代码行数:7,代码来源:Program.cs


示例15: CommandMessagePump

 public CommandMessagePump(MessagingFactory messagingFactory, ICommandBroker commandBroker, Type messageType, ILogger logger)
     : base(logger)
 {
     _messagingFactory = messagingFactory;
     _commandBroker = commandBroker;
     _messageType = messageType;
 }
开发者ID:nblumhardt,项目名称:Nimbus,代码行数:7,代码来源:CommandMessagePump.cs


示例16: MulticastEventMessagePump

 public MulticastEventMessagePump(MessagingFactory messagingFactory, IMulticastEventBroker multicastEventBroker, Type eventType, string subscriptionName, ILogger logger, int batchSize)
     : base(logger, batchSize)
 {
     _messagingFactory = messagingFactory;
     _multicastEventBroker = multicastEventBroker;
     _eventType = eventType;
     _subscriptionName = subscriptionName;
 }
开发者ID:nhuhuynh,项目名称:Nimbus,代码行数:8,代码来源:MulticastEventMessagePump.cs


示例17: CreateCommandMessagePumps

 private static void CreateCommandMessagePumps(BusBuilderConfiguration configuration, MessagingFactory messagingFactory, List<IMessagePump> messagePumps)
 {
     foreach (var commandType in configuration.CommandTypes)
     {
         var pump = new CommandMessagePump(messagingFactory, configuration.CommandBroker, commandType, configuration.Logger);
         messagePumps.Add(pump);
     }
 }
开发者ID:nblumhardt,项目名称:Nimbus,代码行数:8,代码来源:BusBuilder.cs


示例18: HeaterCommunication

 public HeaterCommunication()
 {
     var topicNameSend = "businessrulestofieldgateway";
     _topicNameReceive = "fieldgatewaytobusinessrules";
     _namespaceMgr = NamespaceManager.CreateFromConnectionString(CloudConfigurationManager.GetSetting("ServiceBusConnectionString"));
     _factory = MessagingFactory.CreateFromConnectionString(CloudConfigurationManager.GetSetting("ServiceBusConnectionString"));
     _client = _factory.CreateTopicClient(topicNameSend);
 }
开发者ID:Mecabot,项目名称:iot-labs,代码行数:8,代码来源:HeaterCommunication.cs


示例19: TaskOrchestrationClient

 public TaskOrchestrationClient(string connectionString, string orchestrationTopicName)
 {
     this.orchestrationTopicName = orchestrationTopicName;
     this.connectionString = connectionString;
     this.messagingFactory = MessagingFactory.CreateFromConnectionString(this.connectionString);
     this.oxQueueClient = this.messagingFactory.CreateQueueClient(this.orchestrationTopicName);
     this.defaultConverter = new JsonDataConverter();
 }
开发者ID:Frank-Tao,项目名称:durabletask,代码行数:8,代码来源:TaskOrchestrationClient.cs


示例20: ServiceBusListener

 public ServiceBusListener(MessagingFactory messagingFactory, string entityPath, ServiceBusTriggerExecutor triggerExecutor, ServiceBusConfiguration config)
 {
     _messagingFactory = messagingFactory;
     _entityPath = entityPath;
     _triggerExecutor = triggerExecutor;
     _cancellationTokenSource = new CancellationTokenSource();
     _messageProcessor = config.MessagingProvider.CreateMessageProcessor(entityPath);
 }
开发者ID:GPetrites,项目名称:azure-webjobs-sdk,代码行数:8,代码来源:ServiceBusListener.cs



注:本文中的MessagingFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Messenger类代码示例发布时间:2022-05-24
下一篇:
C# Messages类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap