/// <summary> /// Sends the specified endpoint. /// </summary> /// <param name="endpoint">The endpoint.</param> /// <param name="messages">The messages.</param> /// <returns></returns> public override IServiceBusCallback Send(IServiceBusEndpoint endpoint, params object[] messages) { if (messages == null || messages.Length == 0 || messages[0] == null) { throw new ArgumentNullException("messages", "Please include at least one message."); } if (endpoint == null) { endpoint = RhinoServiceBusTransport.EndpointByMessageType(messages[0].GetType()); } try { if (endpoint == null) { Bus.Send(RhinoServiceBusTransport.Wrap(messages)); } else if (endpoint != ServiceBus.SelfEndpoint) { Bus.Send(RhinoServiceBusTransport.Cast(endpoint), RhinoServiceBusTransport.Wrap(messages)); } else { Bus.SendToSelf(RhinoServiceBusTransport.Wrap(messages)); } } catch (Exception ex) { throw new ServiceBusMessageException(messages[0].GetType(), ex); } return(null); }
/// <summary> /// Unsubscribes the specified message type. /// </summary> /// <param name="messageType">Type of the message.</param> public override void Unsubscribe(Type messageType) { if (messageType == null) { throw new ArgumentNullException("messageType"); } try { Bus.Unsubscribe(RhinoServiceBusTransport.Wrap(messageType)); } catch (Exception ex) { throw new ServiceBusMessageException(messageType, ex); } }
/// <summary> /// Replies the specified messages. /// </summary> /// <param name="messages">The messages.</param> public override void Reply(params object[] messages) { if (messages == null || messages.Length == 0 || messages[0] == null) { throw new ArgumentNullException("messages", "Please include at least one message."); } try { Bus.Reply(RhinoServiceBusTransport.Wrap(messages)); } catch (Exception ex) { throw new ServiceBusMessageException(messages[0].GetType(), ex); } }
/// <summary> /// Subscribes the specified message type. /// </summary> /// <param name="messageType">Type of the message.</param> /// <param name="condition">The condition.</param> public override void Subscribe(Type messageType, Predicate <object> condition) { if (messageType == null) { throw new ArgumentNullException("messageType"); } if (condition != null) { throw new ArgumentException("condition", "Must be null."); } try { Bus.Subscribe(RhinoServiceBusTransport.Wrap(messageType)); } catch (Exception ex) { throw new ServiceBusMessageException(messageType, ex); } }
/// <summary> /// Sends the specified endpoint. /// </summary> /// <param name="endpoint">The endpoint.</param> /// <param name="messages">The messages.</param> /// <returns></returns> public virtual IServiceBusCallback Send(IServiceBusEndpoint endpoint, params object[] messages) { if (messages == null || messages.Length == 0 || messages[0] == null) { throw new ArgumentNullException("messages", "Please include at least one message."); } if (endpoint == null) { endpoint = RhinoServiceBusTransport.EndpointByMessageType(messages[0].GetType()); } try { if (endpoint == null) { Bus.Send(messages); } else { throw new NotSupportedException(); } } catch (Exception ex) { throw new ServiceBusMessageException(messages[0].GetType(), ex); } return(null); }
/// <summary> /// Publishes the specified messages. /// </summary> /// <param name="messages">The messages.</param> public override void Publish(params object[] messages) { try { Bus.Publish(RhinoServiceBusTransport.Wrap(messages)); } catch (Exception ex) { throw new ServiceBusMessageException(messages[0].GetType(), ex); } }