/// <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);
        }
        private static Publish getPublishMessage(NetMessage message)
        {
            NetPublish netPublish = message.Action.PublishMessage;

            Publish publish = new Publish();

            publish.Action_id        = netPublish.ActionId;
            publish.Destination      = netPublish.Destination;
            publish.Destination_type = translate(netPublish.DestinationType);
            publish.Message          = getBrokerMessage(netPublish.Message);

            return(publish);
        }
        /// <summary>
        /// Publish a message (to a topic).
        /// </summary>
        /// <param name="message">A broker message</param>
        /// <param name="destination">A destination (e.g. "/topic/foo")</param>
        /// <param name="acceptRequest">An AcceptRequest instance.</param>
        public void Publish(NetBrokerMessage message, string destination, AcceptRequest acceptRequest)
        {
            if (IsClosed())
            {
                return;
            }

            NetPublish publish = new NetPublish(destination, NetAction.DestinationType.TOPIC, message);

            NetAction action = new NetAction(NetAction.ActionType.PUBLISH);

            action.PublishMessage = publish;

            NetMessage netMessage = new NetMessage(action, message.Headers);

            protocolHandler.HandleOutgoingMessage(netMessage, acceptRequest);
        }
示例#4
0
        /// <summary>
        /// Publish a message (to a topic).
        /// </summary>
        /// <param name="message">A broker message</param>
        /// <param name="destination">A destination (e.g. "/topic/foo")</param>
        /// <param name="acceptRequest">An AcceptRequest instance.</param>
        public void Publish(NetBrokerMessage message, string destination, AcceptRequest acceptRequest)
        {
            if (IsClosed())
                return;

            NetPublish publish = new NetPublish(destination, NetAction.DestinationType.TOPIC, message);

            NetAction action = new NetAction(NetAction.ActionType.PUBLISH);
            action.PublishMessage = publish;

            NetMessage netMessage = new NetMessage(action, message.Headers);

            protocolHandler.HandleOutgoingMessage(netMessage, acceptRequest);
        }
示例#5
0
        /// <summary>
        /// Publish 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 PublishMessageOverUdp(NetBrokerMessage message, string destination, HostInfo hostInfo, IMessageSerializer messageSerializer)
        {
            NetPublish publish = new NetPublish(destination, NetAction.DestinationType.TOPIC, message);

            NetAction action = new NetAction(NetAction.ActionType.PUBLISH);
            action.PublishMessage = publish;

            NetMessage netMessage = new NetMessage(action, message.Headers);

            BrokerProtocolHandler.SendMessageOverUdp(netMessage, hostInfo, messageSerializer);
        }