public CallbackQueueRPCStrategy(ClientSettings clientSettings, string queueName) { this.clientSettings = clientSettings; if(String.IsNullOrEmpty(queueName)) { queueName = SynchronizedRandom.Instance.Next().ToString(); } else { queueName = queueName.Trim(); } this.indirectReplyToQueueName = AmqpUtils.GetCallbackQueueName(queueName, AmqpUtils.GetNewExclusiveQueueId()); //Initialize expectedResponses expectedResponses = new ConcurrentDictionary<string, ExpectedResponse>(); }
/// <summary> /// Initializes a new instance of the <see cref="T:RestBus.RabbitMQ.RestBusClient" /> class. /// </summary> /// <param name="messageMapper">The <see cref="IMessageMapper" /> the client uses to route messages.</param> /// <param name="settings">Client settings.</param> public RestBusClient(IMessageMapper messageMapper, ClientSettings settings ) : base(new HttpClientHandler(), true) { //Set default HttpClient related fields timeout = TimeSpan.FromSeconds(100); MaxResponseContentBufferSize = int.MaxValue; //TODO: Setup cancellation token here. //Ensure messageMapper server uris are valid AmqpConnectionInfo.EnsureValid(messageMapper.ServerUris, "messageMapper.ServerUris"); //Configure RestBus fields/properties this.messageMapper = messageMapper; this.messagingConfig = messageMapper.MessagingConfig; //Fetched only once. if (messagingConfig == null) throw new ArgumentException("messageMapper.MessagingConfig returned null"); //Set ClientSettings this.Settings = settings ?? new ClientSettings(); // Always have a default instance, if it wasn't passed in. this.Settings.Client = this; //Indicate that the settings is owned by this client. //Instantiate connection manager and RPC strategies; connectionMgr = new ConnectionManager(messageMapper.ServerUris); directStrategy = new DirectReplyToRPCStrategy(); callbackStrategy = new CallbackQueueRPCStrategy(this.Settings, messageMapper.GetServiceName(null)); }