public static RpcServer GetDefault(string mqAddress, IList <string> routeKeyList, string applicationId) { DistributedMQConfig distributedMQConfig = new DistributedMQConfig { ServerAddress = mqAddress, Exchange = "RPC_EXCHANGE", MsgSendType = MessageSendType.Router, IsDurable = false }; RpcServer server = new RpcServer(distributedMQConfig, routeKeyList, applicationId); return(server); }
public static IMessageQueue Create(DistributedMQConfig distributedMQConfig, MessageQueueTypeEnum messageQueueTypeEnum = 0, IList <string> routeKeyList = null, string applicationId = null) { IMqFactory mqFactory = null; switch (messageQueueTypeEnum) { case MessageQueueTypeEnum.RabbitMq: { mqFactory = new RabbitMQ.Factory.RabbitMqFactory(distributedMQConfig, applicationId, routeKeyList); }; break; // return new RouterMQ(distributedMQConfig,applicationId, routeKeyList); } return(mqFactory.CreateRabbitFactory()); }
public SimpleMQ(DistributedMQConfig mqConfig, string applicationId = null) : base(mqConfig) { this._encoding = mqConfig.DefaultEncoding; ConnectionFactory factory1 = new ConnectionFactory(); factory1.AutomaticRecoveryEnabled = true; factory1.TopologyRecoveryEnabled = true; factory1.Uri = new Uri(mqConfig.ServerAddress); ConnectionFactory factory = factory1; this._ApplicationCode = applicationId; this._queue = base.MQConfig.ProducerID; _connection = factory.CreateConnection(mqConfig.Name); this.CreateMQ(null); }
public RpcServer StartServer() { DistributedMQConfig distributedMQConfig = new DistributedMQConfig { ServerAddress = this.MqRpcConfig.MqAddress, Exchange = this.MqRpcConfig.Exchange, ProducerID = GetCurrentServerRpcName(), MsgSendType = MessageSendType.Router, IsDurable = false }; var routeKeyList = IocUnity.Get <DefaultRegisterService>().GetRouteKeyList(); RpcServer server = new RpcServer(distributedMQConfig, routeKeyList, null); server.ReciveMsgedEvent -= new ReciveMQMessageHandler(RpcServer_ReciveMsgedEvent); server.ReciveMsgedEvent += new ReciveMQMessageHandler(RpcServer_ReciveMsgedEvent); CurrentRpcServer = server; return(server); }
public RpcServer(DistributedMQConfig distributedMQConfig, IList <string> routeKeyList, string applicationId) : base(distributedMQConfig) { this.MQConfig = distributedMQConfig; this.MsgQueue = MQFactory.Create(distributedMQConfig, MessageQueueTypeEnum.RabbitMq, routeKeyList, applicationId); this.MsgQueue.ReceiveMQ(delegate(MQMessage msg) { if ((msg != null) && (msg.Response != null)) { MQMsgRequest request1 = new MQMsgRequest { Exchange = msg.Response.Exchange, RequestRouteKey = msg.Response.ResponseRouteKey }; msg.Request = request1; msg.Response = null; } if (this.ReciveMsgedEvent != null) { this.ReciveMsgedEvent(msg); } }); }
public RpcClient(DistributedMQConfig distributedMQConfig, MQMsgRequest mQMsgRequest = null, string applicationId = null) : base(distributedMQConfig) { this.ApplicationId = applicationId; this.MQConfig = distributedMQConfig; this.MsgQueue = MQFactory.Create(this.MQConfig, MessageQueueTypeEnum.RabbitMq, null, applicationId); if (!string.IsNullOrEmpty(this.MQConfig.ProducerID)) { this.MsgQueue.DeleteMQ(this.MQConfig.ProducerID, true, true); } string str = IdentityHelper.NewSequentialGuid().ToString("N"); if (string.IsNullOrEmpty(this.MQConfig.Exchange)) { this.MQConfig.Exchange = MQDefaultSetting._Exchange; } MQMsgResponse response1 = new MQMsgResponse { Exchange = this.MQConfig.Exchange, ResponseQueue = MQDefaultSetting._prefixQueue + "-" + str, ResponseRouteKey = str }; this._mQMsgResponse = response1; if (mQMsgRequest == null) { MQMsgRequest request1 = new MQMsgRequest { Exchange = this.MQConfig.Exchange, RequestRouteKey = MQDefaultSetting._RequestRouteKey }; this._mQMsgRequest = request1; } else { this._mQMsgRequest = mQMsgRequest; } }
public override IMessageQueue CreateInstance(DistributedMQConfig mqConfig) => new RouterMQ(mqConfig, null);
public IMessageQueue CreateInstance(DistributedMQConfig mqConfig) { throw new NotImplementedException(); }
public RabbitMqFactory(DistributedMQConfig mQConfig, string applicationId, IList <string> routeKeyList) { this.MqConfig = mQConfig; this.ApplicationId = applicationId; this.RouteKeyList = routeKeyList; }
public abstract IMessageQueue CreateInstance(DistributedMQConfig mqConfig);
protected MessageQueueBase(DistributedMQConfig mqConfig) { this.mQConfig = mqConfig; }
protected RocketMqMessageQueue(DistributedMQConfig mqConfig) : base(mqConfig) { }
public RpcBase(DistributedMQConfig distributedMQConfig) { this.MQConfig = distributedMQConfig; }