Package flex.messaging

Examples of flex.messaging.MessageClient


    public MessageClient getMessageClient(Object clientId, String endpointId)
    {
        synchronized (allSubscriptions)
        {
            MessageClient client = (MessageClient) allSubscriptions.get(clientId);
            if (client == null)
            {
                client = newMessageClient(clientId, endpointId);
                allSubscriptions.put(clientId, client);
            }

            client.incrementReferences();
            return client;
        }
    }
View Full Code Here


                SubscriptionManager subscriptionManager = destination.getSubscriptionManager();

                for (Iterator clientIter = subscriberIds.iterator(); clientIter.hasNext();)
                {
                    Object clientId = clientIter.next();
                    MessageClient client = (MessageClient)subscriptionManager.getSubscriber(clientId);

                    // Skip if the client is null or invalidated.
                    if (client == null || !client.isValid())
                    {
                        if (Log.isDebug())
                            Log.getLogger(MessageService.LOG_CATEGORY).debug("Warning: could not find MessageClient for clientId in pushMessageToClients: " + clientId + " for destination: " + destination.getId());

                        continue;
View Full Code Here

        {
            // This code path handles poll messages sent by Consumer.receive().
            // This API should not trigger server side waits, so we invoke poll
            // and if there are no queued messages for this Consumer instance we
            // return an empty acknowledgement immediately.
            MessageClient client = null;
            try
            {
                client = subscriptionManager.getMessageClient(clientId, endpointId);

                if (client != null)
                {
                    if (adapter.handlesSubscriptions())
                    {
                        List missedMessages = (List)adapter.manage(command);
                        if (missedMessages != null && !missedMessages.isEmpty())
                        {
                            MessageBroker broker = getMessageBroker();
                            for (Iterator iter = missedMessages.iterator(); iter.hasNext();)
                                broker.routeMessageToMessageClient((Message)iter.next(), client);
                        }
                    }
                    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());
View Full Code Here

    private void invalidateMessageClient(JMSConsumer consumer, flex.messaging.messages.Message message)
    {
        String clientId = (String)consumerToClientId.get(consumer);
        if (clientId != null && messageClients.containsKey(clientId))
        {
            MessageClient messageClient = (MessageClient)messageClients.get(clientId);

            if (Log.isInfo())
                Log.getLogger(JMSAdapter.LOG_CATEGORY).info("The corresponding MessageClient for JMS consumer for JMS destination '"
                        + consumer.getDestinationJndiName() + "' is being invalidated");
           
            messageClient.invalidate(message);           
        }
    }
View Full Code Here

        {
            String endpointId = getId();           
            List messageClients = flexClient.getMessageClients();
            for (Iterator iter = messageClients.iterator(); iter.hasNext();)
            {
                MessageClient messageClient = (MessageClient)iter.next();
                if (messageClient.getEndpointId().equals(endpointId))
                {
                    messageClient.setClientChannelDisconnected(true);
                    messageClient.invalidate();
                }
            }
        }
       
        // And optionally invalidate the session.
View Full Code Here

TOP

Related Classes of flex.messaging.MessageClient

Copyright © 2018 www.massapicom. 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.