/// <summary>
        /// Get a NetMessage containing a NetSubscribe object that represents this subscription request. This is meant to be used by the messaging framework.
        /// </summary>
        /// <returns>A NetMessage instance.</returns>
        public NetMessage ToNetMessage()
        {
            NetSubscribe netSubscribe = new NetSubscribe(this.destinationPattern, this.destinationType);
            NetAction    netAction    = new NetAction(NetAction.ActionType.SUBSCRIBE);

            netAction.SubscribeMessage = netSubscribe;
            NetMessage netMessage = new NetMessage(netAction, this.Headers);

            return(netMessage);
        }
        private static Subscribe getSubscribeMessage(NetMessage message)
        {
            NetSubscribe netSubs = message.Action.SubscribeMessage;

            Subscribe subs = new Subscribe();

            subs.Action_id        = netSubs.ActionId;
            subs.Destination      = netSubs.Destination;
            subs.Destination_type = translate(netSubs.DestinationType);

            return(subs);
        }
        /// <summary>
        /// Subscribe to a destination.
        /// </summary>
        /// <param name="subscription">A Subscription instance.</param>
        /// <param name="acceptRequest">An AcceptRequest instance.</param>
        public void Subscribe(Subscription subscription, AcceptRequest acceptRequest)
        {
            if (IsClosed())
            {
                return;
            }

            subscription.BrokerClient = this;

            NetSubscribe netSubscribe = new NetSubscribe(subscription.DestinationPattern, subscription.DestinationType);
            NetAction    action       = new NetAction(NetAction.ActionType.SUBSCRIBE);

            action.SubscribeMessage = netSubscribe;
            NetMessage netMessage = new NetMessage(action, subscription.Headers);

            protocolHandler.HandleOutgoingMessage(netMessage, acceptRequest);

            protocolHandler.AddSubscription(subscription);
        }
Пример #4
0
        /// <summary>
        /// Get a NetMessage containing a NetSubscribe object that represents this subscription request. This is meant to be used by the messaging framework.
        /// </summary>
        /// <returns>A NetMessage instance.</returns>
        public NetMessage ToNetMessage()
        {
            NetSubscribe netSubscribe = new NetSubscribe(this.destinationPattern, this.destinationType);
            NetAction netAction = new NetAction(NetAction.ActionType.SUBSCRIBE);
            netAction.SubscribeMessage = netSubscribe;
            NetMessage netMessage = new NetMessage(netAction, this.Headers);

            return netMessage;
        }
Пример #5
0
        /// <summary>
        /// Subscribe to a destination.
        /// </summary>
        /// <param name="subscription">A Subscription instance.</param>
        /// <param name="acceptRequest">An AcceptRequest instance.</param>
        public void Subscribe(Subscription subscription, AcceptRequest acceptRequest)
        {
            if (IsClosed())
                return;

            subscription.BrokerClient = this;

            NetSubscribe netSubscribe = new NetSubscribe(subscription.DestinationPattern, subscription.DestinationType);
            NetAction action = new NetAction(NetAction.ActionType.SUBSCRIBE);
            action.SubscribeMessage = netSubscribe;
            NetMessage netMessage = new NetMessage(action, subscription.Headers);

            protocolHandler.HandleOutgoingMessage(netMessage, acceptRequest);

            protocolHandler.AddSubscription(subscription);
        }