public ICallback Send(params object[] messages) { var destinations = GetAddressForMessages(messages) .Distinct() .ToList(); if (destinations.Count > 1) { throw new InvalidOperationException("Sends can only target one address."); } if (destinations.Count == 0) { var messageType = "none"; if (messages != null && messages.Length >= 1) { messageType = messages[0].GetType().ToString(); } var error = string.Format("No destination could be found for message type {0}. Check the <MessageEndpointMappings> section of the configuration of this endpoint for an entry either for this specific message type or for its assembly.", messageType); throw new InvalidOperationException(error); } var destination = destinations[0]; return(SendMessages(new SendOptions(destination), LogicalMessageFactory.CreateMultiple(messages))); }
public void Reply(params object[] messages) { var options = SendOptions.ReplyTo(MessageBeingProcessed.ReplyToAddress); options.CorrelationId = !string.IsNullOrEmpty(MessageBeingProcessed.CorrelationId) ? MessageBeingProcessed.CorrelationId : MessageBeingProcessed.Id; SendMessages(options, LogicalMessageFactory.CreateMultiple(messages)); }
public ICallback Send(Address address, string correlationId, params object[] messages) { var options = new SendOptions(address) { CorrelationId = correlationId }; return(SendMessages(options, LogicalMessageFactory.CreateMultiple(messages))); }
public ICallback SendLocal(params object[] messages) { //if we're a worker, send to the distributor data bus if (Configure.Instance.WorkerRunsOnThisEndpoint()) { return(SendMessages(new SendOptions(MasterNodeAddress), LogicalMessageFactory.CreateMultiple(messages))); } return(SendMessages(new SendOptions(Address.Local), LogicalMessageFactory.CreateMultiple(messages))); }
public ICallback Send(string destination, string correlationId, object message) { var options = new SendOptions(destination) { CorrelationId = correlationId }; return(SendMessages(options, LogicalMessageFactory.CreateMultiple(message))); }
public ICallback Send <T>(Address address, string correlationId, Action <T> messageConstructor) { var options = new SendOptions(address) { CorrelationId = correlationId }; return(SendMessages(options, LogicalMessageFactory.CreateMultiple(CreateInstance(messageConstructor)))); }
public ICallback Defer(DateTime processAt, params object[] messages) { var options = new SendOptions(Address.Local) { DeliverAt = processAt, EnforceMessagingBestPractices = false }; return(SendMessages(options, LogicalMessageFactory.CreateMultiple(messages))); }
public ICallback Defer(TimeSpan delay, params object[] messages) { var options = new SendOptions(Address.Local) { DelayDeliveryWith = delay, EnforceMessagingBestPractices = false }; return(SendMessages(options, LogicalMessageFactory.CreateMultiple(messages))); }
public ICallback Send(params object[] messages) { var destinations = GetAddressForMessages(messages) .Distinct() .ToList(); if (destinations.Count > 1) { throw new InvalidOperationException("Sends can only target one address."); } var destination = destinations.SingleOrDefault(); return(SendMessages(new SendOptions(destination), LogicalMessageFactory.CreateMultiple(messages))); }
public ICallback Defer(DateTime processAt, params object[] messages) { SendOptions options; if (Configure.Instance.WorkerRunsOnThisEndpoint()) { options = new SendOptions(MasterNodeAddress); } else { options = new SendOptions(Address.Local); } options.DeliverAt = processAt; options.EnforceMessagingBestPractices = false; return(SendMessages(options, LogicalMessageFactory.CreateMultiple(messages))); }
/// <summary> /// Publishes the messages to all subscribers of the first message's type. /// </summary> public virtual void Publish <T>(params T[] messages) { if (messages == null || messages.Length == 0) { return; } var messagesToPublish = messages.Cast <object>().ToList(); var sendOptions = new SendOptions { Intent = MessageIntentEnum.Publish }; var context = InvokeSendPipeline(sendOptions, LogicalMessageFactory.CreateMultiple(messagesToPublish)); if (!context.Get <bool>("SubscribersFound") && NoSubscribersForMessage != null) { NoSubscribersForMessage(this, new MessageEventArgs(messagesToPublish.First())); } }
public ICallback SendToSites(IEnumerable <string> siteKeys, params object[] messages) { Headers.SetMessageHeader(messages[0], Headers.DestinationSites, string.Join(",", siteKeys.ToArray())); return(SendMessages(new SendOptions(MasterNodeAddress.SubScope("gateway")), LogicalMessageFactory.CreateMultiple(messages))); }
public ICallback Send(Address address, params object[] messages) { return(SendMessages(new SendOptions(address), LogicalMessageFactory.CreateMultiple(messages))); }
public ICallback Send(string destination, params object[] messages) { return(SendMessages(new SendOptions(destination), LogicalMessageFactory.CreateMultiple(messages))); }
public ICallback Send <T>(Address address, Action <T> messageConstructor) { return(SendMessages(new SendOptions(address), LogicalMessageFactory.CreateMultiple(CreateInstance(messageConstructor)))); }
public ICallback Send <T>(string destination, Action <T> messageConstructor) { return(SendMessages(new SendOptions(destination), LogicalMessageFactory.CreateMultiple(CreateInstance(messageConstructor)))); }