/// <summary> /// Creates a SslBrokerClient instance. /// </summary> /// <param name="hosts">Information about agents.</param> /// <param name="collection">A collection of X.509 certificates. Useful when agents are not using a key that can be validated by a trusted X.509 certificate.</param> public SslBrokerClient(IList <HostInfo> hosts, X509CertificateCollection collection) { this.hosts = hosts; SslNetworkHandler sslNetHandler = new SslNetworkHandler(hosts, collection); protocolHandler = new BrokerProtocolHandler(messageSerializer, sslNetHandler); }
/// <summary> /// Creates a BrokerClient instance and connects to an agent. /// </summary> /// <param name="hosts">Information about agents.</param> public BrokerClient(IList <HostInfo> hosts) { this.hosts = hosts; NetworkHandler networkHandler = new NetworkHandler(hosts); protocolHandler = new BrokerProtocolHandler(messageSerializer, networkHandler); }
/// <summary> /// Enqueue a message over UDP. /// </summary> /// <param name="message">Message content.</param> /// <param name="destination">Message destination.</param> /// <param name="hostInfo">Agent information.</param> /// <param name="messageSerializer">Serialization type.</param> public static void EnqueueMessageOverUdp(NetBrokerMessage message, string destination, HostInfo hostInfo, IMessageSerializer messageSerializer) { NetPublish publish = new NetPublish(destination, NetAction.DestinationType.QUEUE, message); NetAction action = new NetAction(NetAction.ActionType.PUBLISH); action.PublishMessage = publish; NetMessage netMessage = new NetMessage(action, message.Headers); BrokerProtocolHandler.SendMessageOverUdp(netMessage, hostInfo, messageSerializer); }
/// <summary> /// Creates a BrokerClient instance and connects to an agent. /// </summary> /// <param name="hostInfo">Information about an agent.</param> public BrokerClient(HostInfo hostInfo) { IList <HostInfo> hosts = new List <HostInfo>(1); hosts.Add(hostInfo); this.hosts = hosts; NetworkHandler networkHandler = new NetworkHandler(hosts); protocolHandler = new BrokerProtocolHandler(messageSerializer, networkHandler); protocolHandler.OnCommunicationFailed += new CommunicationFailed(HandleOnCommunicationFailed); }