Package org.torquebox.messaging

Examples of org.torquebox.messaging.MessageProcessorGroup


        if (destinationMetaData == null) {
            log.warn("Destination metadata couldn't be found, most likely something is wrong");
        }

        MessageProcessorGroup service;

        DeploymentUnit unit = phaseContext.getDeploymentUnit();
        ServiceName baseServiceName = MessagingServices.messageProcessor( unit, metaData.getName() );

        log.debugf("Installing a message processor for destination '%s'", metaData.getDestinationName());

        if (destinationMetaData != null && destinationMetaData.isRemote()) {
            log.debug("Destination is located on a remote host");
            service = new RemoteMessageProcessorGroup( phaseContext.getServiceRegistry(), baseServiceName, metaData.getDestinationName(), destinationMetaData.getRemoteHost(), destinationMetaData.getUsername(), destinationMetaData.getPassword() );
        } else {
            service = new MessageProcessorGroup( phaseContext.getServiceRegistry(), baseServiceName, metaData.getDestinationName() );
        }

        service.setConcurrency( metaData.getConcurrency() );
        service.setDurable( metaData.isDurable() );
        service.setClientID( metaData.getClientID() );
        service.setMessageSelector( metaData.getMessageSelector() );
        service.setName( metaData.getName() );
        service.setXAEnabled( metaData.isXAEnabled() );
        service.setSynchronous( metaData.isSynchronous() );
        service.setStoppedAfterDeploy( metaData.isStopped() );

        ServiceBuilder<BaseMessageProcessorGroup> builder = phaseContext.getServiceTarget().addService( baseServiceName, service )
                .addDependency( MessagingServices.messageProcessorComponentResolver( unit, metaData.getName() ), ComponentResolver.class, service.getComponentResolverInjector() )
                .addDependency( CoreServices.runtimePoolName( unit, "messaging" ), RubyRuntimePool.class, service.getRuntimePoolInjector() );

        if (destinationMetaData == null || !destinationMetaData.isRemote()) {
            builder
                    .addDependency( getConnectionFactoryServiceName(), ManagedReferenceFactory.class, service.getConnectionFactoryInjector() )
                    .addDependency( getDestinationServiceName( metaData.getDestinationName() ), ManagedReferenceFactory.class, service.getDestinationInjector() );
        }

        if (metaData.isSingleton()) {
            builder.addDependency( HASingleton.serviceName( unit, "global" ) );
            builder.setInitialMode( Mode.PASSIVE );
View Full Code Here


    public void testDispatchMessage() throws Exception {
        MessageProcessorComponent processor = new MessageProcessorComponent();
        processor.setRubyComponent( this.rubyProcessor );

        Message message = mock( TextMessage.class );
        MessageProcessorGroup group = mock( MessageProcessorGroup.class );

        processor.process( message, null, group );
       
        List messages = (List) RuntimeHelper.getIfPossible( ruby, rubyProcessor, "messages" );
        assertNotNull( messages );
View Full Code Here

TOP

Related Classes of org.torquebox.messaging.MessageProcessorGroup

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.