public TapetiPublisher(ITapetiConfig config, Func <ITapetiClient> clientFactory) { this.config = config; this.clientFactory = clientFactory; exchangeStrategy = config.DependencyResolver.Resolve <IExchangeStrategy>(); routingKeyStrategy = config.DependencyResolver.Resolve <IRoutingKeyStrategy>(); messageSerializer = config.DependencyResolver.Resolve <IMessageSerializer>(); }
/// <summary> /// Creates a new instance of a TapetiConnection and registers a default IPublisher /// in the IoC container as provided in the config. /// </summary> /// <param name="config"></param> public TapetiConnection(ITapetiConfig config) { this.config = config; (config.DependencyResolver as IDependencyContainer)?.RegisterDefault(GetPublisher); client = new Lazy <ITapetiClient>(() => new TapetiClient(config, Params ?? new TapetiConnectionParams()) { ConnectionEventListener = new ConnectionEventListener(this) }); }
public TapetiConsumer(CancellationToken cancellationToken, ITapetiConfig config, string queueName, IEnumerable <IBinding> bindings) { this.cancellationToken = cancellationToken; this.config = config; this.queueName = queueName; this.bindings = bindings.ToList(); logger = config.DependencyResolver.Resolve <ILogger>(); exceptionStrategy = config.DependencyResolver.Resolve <IExceptionStrategy>(); messageSerializer = config.DependencyResolver.Resolve <IMessageSerializer>(); }
private static ResponseHandlerInfo GetResponseHandlerInfo(ITapetiConfig config, object request, Delegate responseHandler) { var requestAttribute = request.GetType().GetCustomAttribute <RequestAttribute>(); if (requestAttribute?.Response == null) { throw new ArgumentException($"Request message {request.GetType().Name} must be marked with the Request attribute and a valid Response type", nameof(request)); } var binding = config.Bindings.ForMethod(responseHandler); if (binding == null) { throw new ArgumentException("responseHandler must be a registered message handler", nameof(responseHandler)); } if (!binding.Accept(requestAttribute.Response)) { throw new ArgumentException($"responseHandler must accept message of type {requestAttribute.Response}", nameof(responseHandler)); } var continuationAttribute = binding.Method.GetCustomAttribute <ContinuationAttribute>(); if (continuationAttribute == null) { throw new ArgumentException("responseHandler must be marked with the Continuation attribute", nameof(responseHandler)); } if (binding.QueueName == null) { throw new ArgumentException("responseHandler is not yet subscribed to a queue, TapetiConnection.Subscribe must be called before starting a flow", nameof(responseHandler)); } return(new ResponseHandlerInfo { MethodName = MethodSerializer.Serialize(responseHandler.Method), ReplyToQueue = binding.QueueName, IsDurableQueue = binding.QueueType == QueueType.Durable }); }
public ParallelRequestBuilder(ITapetiConfig config, SendRequestFunc sendRequest) { this.config = config; this.sendRequest = sendRequest; }
/// <summary> /// </summary> public FlowProvider(ITapetiConfig config, IPublisher publisher) { this.config = config; this.publisher = (IInternalPublisher)publisher; }
/// <summary> /// </summary> public FlowStarter(ITapetiConfig config) { this.config = config; }
public TapetiSubscriber(Func <ITapetiClient> clientFactory, ITapetiConfig config) { this.clientFactory = clientFactory; this.config = config; }