/// <summary> /// 接收消息 /// </summary> /// <param name="msg"></param> public static void Subscribe(Message msg, IProcessMessage ipro) { //// 创建消息bus //using (IBus bus = BusBuilder.CreateMessageBus()) //{ // try // { // bus.Subscribe<Message>(msg.MessageRouter, message => ipro.ProcessMsg(message), x => x.WithTopic(msg.MessageRouter)); // } // catch (EasyNetQException ex) // { // //处理连接消息服务器异常 // } //} //// 创建消息bus IBus bus = BusBuilder.CreateMessageBus(); try { bus.Subscribe <Message>(msg.MessageRouter, message => ipro.ProcessMsg(message), x => x.WithTopic(msg.MessageRouter)); } catch (EasyNetQException ex) { //处理连接消息服务器异常 } }
public ProcessEventHubParallelized(TelemetryConfiguration configuration, ILogger <ProcessEventHubParallelized> log, IProcessMessage processMessage) { _clientTMetry = new TelemetryClient(configuration); _logger = log; _processMessage = processMessage; }
public ProcessEventHubTriggerGeneratedByDefault(TelemetryConfiguration configuration, ILogger <ProcessEventHubTriggerGeneratedByDefault> log, IProcessMessage processMessage) { _clientTMetry = new TelemetryClient(configuration); _logger = log; _processMessage = processMessage; }
public ProcessingServiceTests() { LogManager.OutputToTrace(); _storage = Substitute.For<IStoreUnhandledMessages>(); _processor = Substitute.For<IProcessMessage>(); _errors = Substitute.For<IFailedMessagesQueue>(); _sut =new ProcessingService(_storage,()=>_processor,new BusAuditor(new InMemoryAuditStorage()), _errors); _sut.PollingEnabled = false; _sut.Start(); }
public ProcessingServiceTests() { //LogManager.OutputToTrace(); _storage = Substitute.For <IStoreUnhandledMessages>(); _processor = Substitute.For <IProcessMessage>(); _errors = Substitute.For <IFailedMessagesQueue>(); _sut = new ProcessingService(_storage, () => _processor, new BusAuditor(new InMemoryAuditStorage()), _errors); _sut.PollingEnabled = false; _sut.Start(); }
public ClientSubscription(IConfiguration configuration, IProcessMessage processData) { this.configuration = configuration; //subscriptionClient = new SubscriptionClient( // configuration.GetConnectionString("ServiceBusConnectionString"), // TOPIC_PATH, // SUBSCRIPTION_NAME); _processData = processData; // _processData = new MessageConsumer(); topicSubscription = new ServiceBusTopicSubscription(processData, configuration);// busTopicSubscription; //handler = ProcessMessageAsync; }
/// <summary> /// 异步接受消息 /// </summary> /// <param name="msg"></param> /// <param name="ipro"></param> public static void SubscribeAsync(Message msg, IProcessMessage ipro) { IBus bus = BusBuilder.CreateMessage(); try { bus.SubscribeAsync <Message>(msg.MessageRouter, m => ipro.ProcessMsgAsync(m)); } catch (Exception) { throw; } }
//private readonly ILogger _logger; public ServiceBusTopicSubscription(IProcessMessage processData, IConfiguration configuration //ILogger<ServiceBusTopicSubscription> logger ) { _processData = processData; _configuration = configuration; //_logger = logger; _subscriptionClient = new SubscriptionClient( _configuration.GetConnectionString("ServiceBusConnectionString"), TOPIC_PATH, SUBSCRIPTION_NAME); }
/// <summary> /// 接收消息 /// </summary> /// <param name="msg"></param> public static void Subscribe(BaseMessage msg, IProcessMessage ipro) { //// 创建消息bus IBus bus = BusBuilder.CreateMessageBus(); try { bus.Subscribe <BaseMessage>(msg.MessageRouter, message => ipro.ProcessMsg(message), x => x.WithTopic(msg.MessageRouter)); } catch (EasyNetQException ex) { throw ex; } }
//public static void PublishFanout(Message msg) //{ // var bus = BusBuilder.CreateMessage(); // try // { // if (bus.IsConnected) // { // var exchange=bus. // } // } // catch (Exception e) // { // throw; // } //} /// <summary> /// 接受消息 /// </summary> /// <param name="msg"></param> /// <param name="ipro"></param> public static void Subscribe(Message msg, IProcessMessage ipro) { //创建消息Bus IBus bus = BusBuilder.CreateMessage(); try { bus.Subscribe <Message>(msg.MessageRouter, m => ipro.ProcessMsg(m), x => x.WithTopic(msg.MessageRouter)); } catch (Exception) { //错误消息处理 } }
/// <summary> /// 接收消息 /// </summary> /// <param name="msg"></param> public static void Subscribe(Message msg, IProcessMessage ipro) { //// 创建消息bus IBus bus = BusBuilder.CreateMessageBus(); try { bus.Subscribe <Message>(msg.MessageID, message => ipro.ProcessMsg(message), x => x.WithTopic(msg.MessageRouter).WithArgument("x-ha-policy", "all")); } catch (EasyNetQException) { //处理连接消息服务器异常 // MessageHelper.WriteFuntionExceptionLog("Subscribe", ex.Message + " | " + ex.StackTrace); } }
private void CreateShareMemoryMessage(bool read) { if (read) { if (readMessage == null) { readMessage = new MemoryMessage(processKey, read); readMessage.AcceptMessage += OnMessage; } } else { if (sendMessage == null) { sendMessage = new MemoryMessage(processKey, read); } } }
private void CreateNamedPipeMessage(bool read) { if (read) { if (readMessage == null) { readMessage = new NamedPipeMessage(processKey, read); readMessage.AcceptMessage += OnMessage; } } else { if (sendMessage == null) { sendMessage = new NamedPipeMessage(processKey, read); } } }
/// <summary> /// Renvois la liste des types de message traiter par la classe de l'objet /// </summary> /// <param name="Target"></param> /// <param name="typeOfMsg"></param> /// <returns></returns> static public List <Type> GetProcessedMessages(this IProcessMessage Target, Type typeOfMsg = null) { return(((object)Target).GetProcessedMessages(typeOfMsg)); }
/// <summary> /// Envois le message TMSG à un objet qui support l'interface IProcessMessage<TMSG>. /// C'est a dire qu'il dispose d'une methode OnReceiveMessage(TMSG) /// </summary> static public void SendMessage <TMSG>(this IProcessMessage <TMSG> objTarget, TMSG msg) where TMSG : IMessage { objTarget.OnReceiveMessage(msg); }
public MessageHandler(IProcessMessage <T> messageProcessor) { this.messageProcessor = messageProcessor; }
public string ProcessRequest(string action, string message) { IProcessMessage processor = MessageProcessorFactory.Instance.GetProcessor(action); return(processor.ProcessMessage(message)); }
/// <summary> /// 停止 /// </summary> public void Stop() { readMessage = null; sendMessage = null; }
public BankInteligentBot(IGreetingMessage greetingMessage, IProcessMessage processMessage) { this.greetingMessage = greetingMessage; this.processMessage = processMessage; }
//装饰者模式必须要传入上一个装饰者对象,如果没有则传null ,这里是IProcessMessage public ProcessMessageDecorator(IProcessMessage <TMessageBase> messageProcessor, ProcessMessageLockHandler distributedLockHandler) { _messageProcessor = messageProcessor; _distributedLockHandler = distributedLockHandler; }
// This function will get triggered/executed when a new message is written // on an Azure Queue called queue. static Functions() { var iDbService = new DbService(); var iQueueService=new QueueService(); _iProcessMessage = new ProcessMessage.ProcessMessage(iDbService, iQueueService); }
public ValiateData(IValidate validate, IProcessMessage processor) { this.validator = validate; //this.processor = processor; }