public BatchedSender(Uri destination, ISenderProtocol protocol, CancellationToken cancellation, CompositeTransportLogger logger) { Destination = destination; _protocol = protocol; _cancellation = cancellation; _logger = logger; }
public HttpTransport(BusSettings settings, JasperRuntime runtime, IPersistence persistence, CompositeTransportLogger logger) { _settings = settings; _runtime = runtime; _persistence = persistence; _logger = logger; }
public TcpTransport(IPersistence persistence, CompositeTransportLogger logger, IWorkerQueue workerQueue, BusSettings settings) { _persistence = persistence; _logger = logger; _workerQueue = workerQueue; _settings = settings; }
public MartenBackedListenerContext() { theStore = DocumentStore.For(_ => { _.Connection(ConnectionSource.ConnectionString); _.PLV8Enabled = false; _.Storage.Add <PostgresqlEnvelopeStorage>(); }); theStore.Advanced.Clean.CompletelyRemoveAll(); theStore.Schema.ApplyAllConfiguredChangesToDatabase(); theWorkerQueue = Substitute.For <IWorkerQueue>(); theSettings = new BusSettings(); var tables = new EnvelopeTables(theSettings, new StoreOptions()); var retries = new MartenRetries(theStore, tables, CompositeTransportLogger.Empty(), theSettings); theListener = new MartenBackedListener( Substitute.For <IListeningAgent>(), theWorkerQueue, theStore, CompositeTransportLogger.Empty(), theSettings, tables, retries); }
public run_scheduled_job_specs() { var logger = CompositeTransportLogger.Empty(); var envelopeTables = new EnvelopeTables(theSettings, new StoreOptions()); var retries = new MartenRetries(theStore, envelopeTables, logger, theSettings); theScheduledJob = new RunScheduledJobs(theWorkerQueue, theStore, envelopeTables, logger, retries); }
protected SendingAgent(Uri destination, ISender sender, CompositeTransportLogger logger, BusSettings settings, RetryAgent retries) { _sender = sender; _logger = logger; Destination = destination; _retries = retries; }
public MartenBackedRetryAgent(IDocumentStore store, ISender sender, RetrySettings settings, EnvelopeTables marker, CompositeTransportLogger logger) : base(sender, settings) { _store = store; _marker = marker; _logger = logger; _deleteIncoming = $"delete from {_marker.Incoming} where id = ANY(:idlist)"; }
public MartenBackedMessagePersistence(IDocumentStore store, CompositeTransportLogger logger, BusSettings settings, EnvelopeTables tables, BusMessageSerializationGraph serializers) { _store = store; _logger = logger; Settings = settings; Tables = tables; _serializers = serializers; _retries = new MartenRetries(_store, tables, _logger, Settings); }
public LocalSendingAgent(Uri destination, IWorkerQueue queues, IDocumentStore store, EnvelopeTables marker, SerializationGraph serializers, MartenRetries retries, CompositeTransportLogger logger) { _queues = queues; _store = store; _marker = marker; _serializers = serializers; _retries = retries; _logger = logger; Destination = destination; }
public MartenBackedSendingAgent(Uri destination, IDocumentStore store, ISender sender, CancellationToken cancellation, CompositeTransportLogger logger, BusSettings settings, EnvelopeTables marker, MartenRetries retries) : base(destination, sender, logger, settings, new MartenBackedRetryAgent(store, sender, settings.Retries, marker, logger)) { _cancellation = cancellation; _logger = logger; _store = store; _settings = settings; _marker = marker; _retries = retries; }
public MartenBackedListener(IListeningAgent agent, IWorkerQueue queues, IDocumentStore store, CompositeTransportLogger logger, BusSettings settings, EnvelopeTables marker, MartenRetries retries) { _agent = agent; _queues = queues; _store = store; _logger = logger; _settings = settings; _marker = marker; _retries = retries; }
public async Task ping_sad_path_with_tcp() { var sender = new BatchedSender("tcp://localhost:2222".ToUri(), new SocketSenderProtocol(), CancellationToken.None, CompositeTransportLogger.Empty()); await Jasper.Testing.Exception <InvalidOperationException> .ShouldBeThrownByAsync(async() => { await sender.Ping(); }); }
public RunScheduledJobs(IWorkerQueue workers, IDocumentStore store, EnvelopeTables marker, CompositeTransportLogger logger, MartenRetries retries) { _workers = workers; _store = store; _marker = marker; _logger = logger; _retries = retries; _findReadyToExecuteJobs = $"select body from {marker.Incoming} where status = '{TransportConstants.Scheduled}' and execution_time <= :time"; _markOwnedIncomingSql = $"update {marker.Incoming} set owner_id = :owner, status = '{TransportConstants.Incoming}' where id = ANY(:idlist)"; }
public RecoverIncomingMessages(IWorkerQueue workers, BusSettings settings, EnvelopeTables marker, ISchedulingAgent schedulingAgent, CompositeTransportLogger logger) { _workers = workers; _settings = settings; _marker = marker; _schedulingAgent = schedulingAgent; _logger = logger; _findAtLargeEnvelopesSql = $"select body from {marker.Incoming} where owner_id = {TransportConstants.AnyNode} and status = '{TransportConstants.Incoming}' limit {settings.Retries.RecoveryBatchSize}"; }
public RecoverOutgoingMessages(IChannelGraph channels, BusSettings settings, EnvelopeTables marker, ISchedulingAgent schedulingAgent, CompositeTransportLogger logger) { _channels = channels; _settings = settings; _marker = marker; _schedulingAgent = schedulingAgent; _logger = logger; _findUniqueDestinations = $"select distinct destination from {_marker.Outgoing}"; _findOutgoingEnvelopesSql = $"select body from {marker.Outgoing} where owner_id = {TransportConstants.AnyNode} and destination = :destination limit {settings.Retries.RecoveryBatchSize}"; _deleteOutgoingSql = $"delete from {marker.Outgoing} where owner_id = :owner and destination = :destination"; }
public async Task ping_happy_path_with_tcp() { using (var runtime = JasperRuntime.For(_ => { _.Transports.LightweightListenerAt(2222); })) { var sender = new BatchedSender("tcp://localhost:2222".ToUri(), new SocketSenderProtocol(), CancellationToken.None, CompositeTransportLogger.Empty()); await sender.Ping(); } }
public MartenRetries(IDocumentStore store, EnvelopeTables tables, CompositeTransportLogger logger, BusSettings settings) { _store = store; _tables = tables; _logger = logger; _settings = settings; _deleteIncoming = new ActionBlock <Envelope[]>(deleteIncoming); _deleteIncomingBatching = new BatchingBlock <Envelope>(250.Milliseconds(), _deleteIncoming, settings.Cancellation); _deleteOutgoing = new ActionBlock <Envelope[]>(deleteOutgoing); _deleteOutgoingBatching = new BatchingBlock <Envelope>(250.Milliseconds(), _deleteOutgoing, settings.Cancellation); _logErrorReport = new ActionBlock <ErrorReport[]>(logErrorReports); _logErrorReportBatching = new BatchingBlock <ErrorReport>(250.Milliseconds(), _logErrorReport, settings.Cancellation); _scheduleIncoming = new ActionBlock <Envelope[]>(scheduleIncoming); _scheduleIncomingBatching = new BatchingBlock <Envelope>(250.Milliseconds(), _scheduleIncoming, settings.Cancellation); }
public SchedulingAgent(IChannelGraph channels, IWorkerQueue workers, IDocumentStore store, BusSettings settings, CompositeTransportLogger logger, StoreOptions storeOptions, MartenRetries retries) { _channels = channels; _workers = workers; _store = store; _settings = settings; _logger = logger; _storeOptions = storeOptions; _worker = new ActionBlock <IMessagingAction>(processAction, new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 1 }); var marker = new EnvelopeTables(_settings, _storeOptions); _scheduledJobs = new RunScheduledJobs(_workers, _store, marker, logger, retries); _incomingMessages = new RecoverIncomingMessages(_workers, _settings, marker, this, _logger); _outgoingMessages = new RecoverOutgoingMessages(_channels, _settings, marker, this, _logger); _nodeReassignment = new ReassignFromDormantNodes(marker, settings); }
public MartenCallbackTests() { theRuntime = JasperRuntime.For(_ => { _.MartenConnectionStringIs(ConnectionSource.ConnectionString); _.ConfigureMarten(x => { x.Storage.Add <PostgresqlEnvelopeStorage>(); x.PLV8Enabled = false; }); }); theStore = theRuntime.Get <IDocumentStore>(); theStore.Advanced.Clean.CompletelyRemoveAll(); theStore.Schema.ApplyAllConfiguredChangesToDatabase(); theEnvelope = ObjectMother.Envelope(); theEnvelope.Status = TransportConstants.Incoming; var marker = new EnvelopeTables(new BusSettings(), new StoreOptions()); using (var session = theStore.OpenSession()) { session.StoreIncoming(marker, theEnvelope); session.SaveChanges(); } var logger = CompositeTransportLogger.Empty(); theRetries = new MartenRetries(theStore, marker, logger, new BusSettings()); theCallback = new MartenCallback(theEnvelope, Substitute.For <IWorkerQueue>(), theStore, marker, theRetries, logger); }
public async Task ping_sad_path_with_http_protocol() { var sender = new BatchedSender("http://localhost:5005/messages".ToUri(), new HttpSenderProtocol(new BusSettings()), CancellationToken.None, CompositeTransportLogger.Empty()); await Jasper.Testing.Exception <HttpRequestException> .ShouldBeThrownByAsync(async() => { await sender.Ping(); }); }
public LightweightListener(IWorkerQueue workerQueue, CompositeTransportLogger logger, IListeningAgent agent) { _workerQueue = workerQueue; _logger = logger; _agent = agent; }
public TcpTransport(IPersistence persistence, CompositeTransportLogger logger, BusSettings settings) { _persistence = persistence; _logger = logger; _settings = settings; }
public NulloPersistence(CompositeTransportLogger logger, BusSettings settings, IWorkerQueue workers) { _logger = logger; _settings = settings; _workers = workers; }
public NulloPersistence(CompositeTransportLogger logger, BusSettings settings) { _logger = logger; _settings = settings; _scheduledJobs = new InMemoryScheduledJobProcessor(); }
public LightweightSendingAgent(Uri destination, ISender sender, CompositeTransportLogger logger, BusSettings settings) : base(destination, sender, logger, settings, new LightweightRetryAgent(sender, settings.Retries)) { }
public async Task ping_happy_path_with_http_protocol() { var sender = new BatchedSender("http://localhost:5005/messages".ToUri(), new HttpSenderProtocol(new BusSettings()), CancellationToken.None, CompositeTransportLogger.Empty()); using (var runtime = JasperRuntime.For(_ => { _.Transports.Http.EnableListening(true); _.Http.UseUrls("http://localhost:5005").UseKestrel(); })) { await sender.Ping(); } }
public BatchedSenderTests() { theSender = new BatchedSender(TransportConstants.RepliesUri, theProtocol, theCancellation.Token, CompositeTransportLogger.Empty()); theSender.Start(theSenderCallback); theBatch = new OutgoingMessageBatch(theSender.Destination, new Envelope[] { Envelope.ForPing(), Envelope.ForPing(), Envelope.ForPing(), Envelope.ForPing(), Envelope.ForPing(), Envelope.ForPing() }); theBatch.Messages.Each(x => x.Destination = theBatch.Destination); }