Examples of CommandMessage


Examples of flex.messaging.messages.CommandMessage

                                    // If the MessageClient isn't attempting client notification, override
                                    // and do so in this case to suppress the next poll request from the remote client
                                    // which will fail triggering an unnecessary channel disconnect on the client.
                                    if (!messageClient.isAttemptingInvalidationClientNotification())
                                    {
                                        CommandMessage msg = new CommandMessage();
                                        msg.setClientId(messageClient.getClientId());
                                        msg.setOperation(CommandMessage.SUBSCRIPTION_INVALIDATE_OPERATION);
                                        List messages = flushResult.getMessages();
                                        if (messages == null)
                                            messages = new ArrayList(1);
                                        messages.add(msg);
                                    }
View Full Code Here

Examples of flex.messaging.messages.CommandMessage

                    }
                    FlushResult flushResult = client.getFlexClient().poll(client);
                    List messagesToReturn = (flushResult != null) ? flushResult.getMessages() : null;
                    if (messagesToReturn != null && !messagesToReturn.isEmpty())
                    {
                        replyMessage = new CommandMessage(CommandMessage.CLIENT_SYNC_OPERATION);
                        replyMessage.setBody(messagesToReturn.toArray());
                    }
                    else
                    {
                        replyMessage = new AcknowledgeMessage();
View Full Code Here

Examples of flex.messaging.messages.CommandMessage

                // or preceded by other messages in the batch; the request-response loop must complete without waiting.
                // If the poll command is the only message in the batch it's OK to wait.
                // If it isn't OK to wait, tag the poll message with a header that short-circuits any potential poll-wait.
                if (inMessage instanceof CommandMessage)
                {
                    CommandMessage command = (CommandMessage)inMessage;
                    if ((command.getOperation() == CommandMessage.POLL_OPERATION) && (context.getRequestMessage().getBodyCount() != 1))
                        command.setHeader(CommandMessage.SUPPRESS_POLL_WAIT_HEADER, Boolean.TRUE);
                }           
               
                // If MPI is enabled update the MPI metrics on the object referred to by the context
                // and the messages
                if (context.isMPIenabled())           
View Full Code Here

Examples of flex.messaging.messages.CommandMessage

            // or preceeded by other messages in the batch; the request-response loop must complete without waiting.
            // If the poll command is the only message in the batch it's ok to wait.
            // If it isn't ok to wait, tag the poll message with a header that short-circuits any potential poll-wait.
            if (inMessage instanceof CommandMessage)
            {
                CommandMessage command = (CommandMessage)inMessage;
                if ((command.getOperation() == CommandMessage.POLL_OPERATION) && (context.getRequestMessage().getBodyCount() != 1))
                    command.setHeader(CommandMessage.SUPPRESS_POLL_WAIT_HEADER, Boolean.TRUE);
            }

            // If MPI is enabled update the MPI metrics on the object referred to by the context
            // and the messages
            if (context.isMPIenabled())
View Full Code Here

Examples of flex.messaging.messages.CommandMessage

            message.setHeader(Message.VALIDATE_ENDPOINT_HEADER, Boolean.TRUE);
        message.setHeader(Message.ENDPOINT_HEADER, getId());

        if (message instanceof CommandMessage)
        {
            CommandMessage command = (CommandMessage)message;

            // Apply channel endpoint level constraint; always allow login commands through.
            int operation = command.getOperation();
            if (operation != CommandMessage.LOGIN_OPERATION)
                checkSecurityConstraint(message);

            // Handle general (not Consumer specific) poll requests here.
            // We need to fetch all outbound messages for client subscriptions over this endpoint.
            // We identify these general poll messages by their operation and a null clientId.           
            if (operation == CommandMessage.POLL_OPERATION && message.getClientId() == null)
            {
                verifyFlexClientSupport(command);


                FlexClient flexClient = FlexContext.getFlexClient();
                ack = handleFlexClientPollCommand(flexClient, command);
            }
            else if (operation == CommandMessage.DISCONNECT_OPERATION)
            {
                ack = handleChannelDisconnect(command);
            }
            else if (operation == CommandMessage.TRIGGER_CONNECT_OPERATION)
            {
                ack = new AcknowledgeMessage();
            }
            else
            {
                // Block a subset of commands for legacy clients that need to be recompiled to
                // interop with a 2.5+ server.
                if (operation == CommandMessage.SUBSCRIBE_OPERATION || operation == CommandMessage.POLL_OPERATION)
                    verifyFlexClientSupport(command);

                ack = getMessageBroker().routeCommandToService((CommandMessage) message, this);

                // Look for client advertised features on initial connect.
                if (operation == CommandMessage.CLIENT_PING_OPERATION || operation == CommandMessage.LOGIN_OPERATION)
                {
                    Number clientVersion = (Number)command.getHeader(CommandMessage.MESSAGING_VERSION);
                    handleClientMessagingVersion(clientVersion);

                    // Also respond by advertising the messaging version on the
                    // acknowledgement.
                    ack.setHeader(CommandMessage.MESSAGING_VERSION, new Double(messagingVersion));
View Full Code Here

Examples of flex.messaging.messages.CommandMessage

        // Generate a no-op poll response if necessary; prevents a single client from busy polling when the server
        // is doing wait()-based long-polls.
        if ((flushResult instanceof PollFlushResult) && ((PollFlushResult)flushResult).isClientProcessingSuppressed())
        {
            pollResponse = new CommandMessage(CommandMessage.CLIENT_SYNC_OPERATION);
            pollResponse.setHeader(CommandMessage.NO_OP_POLL_HEADER, Boolean.TRUE);
        }

        if (pollResponse == null)
        {
            List messagesToReturn = (flushResult != null) ? flushResult.getMessages() : null;
            if (messagesToReturn != null && !messagesToReturn.isEmpty())
            {
                pollResponse = new CommandMessage(CommandMessage.CLIENT_SYNC_OPERATION);
                pollResponse.setBody(messagesToReturn.toArray());
            }
            else
            {
                pollResponse = new AcknowledgeMessage();
View Full Code Here

Examples of flex.messaging.messages.CommandMessage

        // Push a disconnect command down to the client to suppress automatic reconnect.
        if (disconnectChannel)
        {
            ArrayList<AsyncMessage> list = new ArrayList<AsyncMessage>(1);
            CommandMessage disconnect = new CommandMessage(CommandMessage.DISCONNECT_OPERATION);
            list.add(disconnect);
            pushMessages(list);           
        }

        // Invalidate associated subscriptions; this doesn't attempt to notify the client.
View Full Code Here

Examples of flex.messaging.messages.CommandMessage

        attemptingInvalidationClientNotification = notifyClient;
       
        // Build a subscription invalidation message and push to the client if it is still valid.
        if (notifyClient && flexClient != null && flexClient.isValid())
        {               
            CommandMessage msg = new CommandMessage();
            msg.setDestination(destination.getId());
            msg.setClientId(clientId);
            msg.setOperation(CommandMessage.SUBSCRIPTION_INVALIDATE_OPERATION);
            Set subscriberIds = new TreeSet();
            subscriberIds.add(clientId);
            try
            {
                ((MessageService)destination.getService()).pushMessageToClients(destination, subscriberIds, msg, false /* don't eval selector */);
            }
            catch (MessageException ignore) {}
        }       
       
        // Notify messageClientDestroyed listeners that we're being invalidated.
        if (destroyedListeners != null && !destroyedListeners.isEmpty())
        {
            for (Iterator iter = destroyedListeners.iterator(); iter.hasNext();)
            {
                ((MessageClientListener)iter.next()).messageClientDestroyed(this);               
            }
            destroyedListeners.clear();
        }

        // And generate unsubscribe messages for all of the MessageClient's subscriptions and
        // route them to the destination this MessageClient is subscribed to.
        // The reason we send a message to the service rather than just going straight to the SubscriptionManager
        // is that some adapters manage their own subscription state (i.e. JMS) in addition to us keeping track of
        // things with our SubscriptionManager.
        ArrayList unsubMessages = new ArrayList();
        synchronized (lock)
        {
            for (Iterator iter = subscriptions.iterator(); iter.hasNext();)
            {
                SubscriptionInfo subInfo = (SubscriptionInfo)iter.next();
                CommandMessage unsubMessage = new CommandMessage();
                unsubMessage.setDestination(destination.getId());
                unsubMessage.setClientId(clientId);
                unsubMessage.setOperation(CommandMessage.UNSUBSCRIBE_OPERATION);
                unsubMessage.setHeader(CommandMessage.SUBSCRIPTION_INVALIDATED_HEADER, Boolean.TRUE);
                unsubMessage.setHeader(CommandMessage.SELECTOR_HEADER, subInfo.selector);
                unsubMessage.setHeader(AsyncMessage.SUBTOPIC_HEADER_NAME, subInfo.subtopic);
                unsubMessages.add(unsubMessage);
            }
        }
        // Release the lock and send the unsub messages.
        for (Iterator iter = unsubMessages.iterator(); iter.hasNext();)
View Full Code Here

Examples of flex.messaging.messages.CommandMessage

        this.password = password;
        this.context = context;
    }

    public SoapUIAMFConnection login() throws ClientStatusException, ServerStatusException {
        CommandMessage commandMessage = createLoginCommandMessage();

        SoapUIAMFConnection amfConnection = new SoapUIAMFConnection();
        amfConnection.connect(endpoint);
        amfConnection.call((SubmitContext) context, null, commandMessage);
        logedIn = true;
View Full Code Here

Examples of flex.messaging.messages.CommandMessage

        return amfConnection;
    }

    public static void logout(SubmitContext context) {
        SoapUIAMFConnection connection = (SoapUIAMFConnection) context.getProperty(AMFSubmit.AMF_CONNECTION);
        CommandMessage commandMessage = createLogoutCommandMessage();
        try {
            connection.call((SubmitContext) context, null, commandMessage);
        } catch (ClientStatusException e) {
            SoapUI.logError(e);
        } catch (ServerStatusException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.