Package flex.messaging

Examples of flex.messaging.MessageBroker


        // if we are stopping a destination with an Application or Session scoped assembler, we may
        // have to remove the assembler from the ServletContext or Session
        if (factoryInstance != null && (FlexFactory.SCOPE_APPLICATION.equals(factoryInstance.getScope()) ||
                                        FlexFactory.SCOPE_SESSION.equals(factoryInstance.getScope())))
        {
            MessageBroker mb = FlexContext.getMessageBroker();
            String attributeId = factoryInstance.getAttributeId();

            if (FlexFactory.SCOPE_APPLICATION.equals(factoryInstance.getScope()))
            {

                ServletContext ctx = FlexContext.getServletConfig().getServletContext();

                // this should never be the case, but just in case
                if (ctx == null || mb == null)
                    return;

                synchronized (ctx)
                {
                    // remove from ServletContext if reference count is zero
                    int refCount = mb.decrementAttributeIdRefCount(attributeId);
                    if (refCount == 0)
                    {
                        // remove assembler from servlet context
                        ctx.removeAttribute(attributeId);
                    }
                }
            }
            else
            {
                FlexSession session = FlexContext.getFlexSession();

                // if this is being stopped during runtime config, we should have a session available to us
                // However, if this is being stopped on MessageBroker shutdown, we will not have a session
                // but do not need to worry about clean up in that case as the entire session will be cleaned up
                if (session == null)
                    return;

                // remove from Session if reference count is zero
                int refCount = mb.decrementAttributeIdRefCount(attributeId);
                if (refCount == 0)
                {
                    // remove assembler from servlet context
                    session.removeAttribute(attributeId);
                }
View Full Code Here


     *
     * @param broker <code>MessageBroker</code> of the <code>AbstractBootstrapService</code>.
     */
    public void setMessageBroker(MessageBroker broker)
    {
        MessageBroker oldBroker = getMessageBroker();                                   

        this.broker = broker;

        if (oldBroker != null)
        {
            oldBroker.removeService(getId());
        }      
               
        // Add service to the new broker if needed
        if (broker.getService(getId()) != this)
            broker.addService(this);       
View Full Code Here

            startDestinations();
            return;
        }
                
        // Check if the MessageBroker is started
        MessageBroker broker = getMessageBroker();
        if (!broker.isStarted())
        {
            if (Log.isWarn())
            {
                Log.getLogger(getLogCategory()).warn("Service with id '{0}' cannot be started" +
                        " when the MessageBroker is not started.",
                        new Object[]{getId()});
            }  
            return;
        }
       
        // Set up management
        if (isManaged() && broker.isManaged())
        {
            setupServiceControl(broker);
            MessageBrokerControl controller = (MessageBrokerControl)broker.getControl();
            if (getControl() != null)
                controller.addService(getControl().getObjectName());
        }
       
        super.start();
View Full Code Here

        String oldId = getId();
       
        super.setId(id);
       
        // Update the service id in the broker
        MessageBroker broker = getMessageBroker();
        if (broker != null)
        {
            // broker must have the service then
            broker.removeService(oldId);
            broker.addService(this);
        }                  
    }    
View Full Code Here

     *
     * @param broker <code>MessageBroker</code> of the <code>AbstractService</code>.
     */
    public void setMessageBroker(MessageBroker broker)
    {   
        MessageBroker oldBroker = getMessageBroker();                                   
                
        setParent(broker);
       
        if (oldBroker != null)
        {
            oldBroker.removeService(getId());
        }      
       
        // Add service to the new broker if needed
        if (broker.getService(getId()) != this)
            broker.addService(this);
View Full Code Here

                    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())
View Full Code Here

        createServices(broker);
    }

    public MessageBroker createBroker(String id, ClassLoader loader)
    {
        return new MessageBroker(systemSettings.isManageable(), id, loader);   
    }
View Full Code Here

    {
        if (isStarted())
            return;
       
        // Check if the MessageBroker is started
        MessageBroker broker = getMessageBroker();
        if (!broker.isStarted())
        {
            if (Log.isWarn())
            {
                Log.getLogger(getLogCategory()).warn("Endpoint with id '{0}' cannot be started" +
                        " when the MessageBroker is not started.",
                        new Object[]{getId()});
            }  
            return;
        }

        // Set up management
        if (isManaged() && broker.isManaged())
        {
            setupEndpointControl(broker);
            MessageBrokerControl controller = (MessageBrokerControl)broker.getControl();
            if (getControl() != null)
                controller.addEndpoint(this);
        }

        // Setup Deserializer and Serializer for the SerializationContext
View Full Code Here

            return;
       
        super.setId(id);
       
        // Update the endpoint id in the broker
        MessageBroker broker = getMessageBroker();
        if (broker != null)
        {
            // broker must have the endpoint then
            broker.removeEndpoint(oldId);
            broker.addEndpoint(this);
        }                  
    }
View Full Code Here

     *
     * @param broker <code>MessageBroker</code> of the <code>AbstractEndpoint</code>.
     */
    public void setMessageBroker(MessageBroker broker)
    {
        MessageBroker oldBroker = getMessageBroker();                                   
       
        setParent(broker);
       
        if (oldBroker != null)
            oldBroker.removeEndpoint(getId());
       
        // Add endpoint to the new broker if needed
        if (broker.getEndpoint(getId()) != this)
            broker.addEndpoint(this);       
    }
View Full Code Here

TOP

Related Classes of flex.messaging.MessageBroker

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.