1
votes

I've used the grails-activemq plugin to embed an ActiveMQ broker into a Grails app running in Tomcat 7. The problem is that the broker is only listening for local connections. netstat -an shows this:

tcp        0      0 127.0.0.1:61616             0.0.0.0:*                   LISTEN

I've set up JNDI in tomcat/conf/context.xml like so

<Context>
    <Resource name="jms/ConnectionFactory" auth="Container"
        type="org.apache.activemq.ActiveMQConnectionFactory" description="JMS Connection Factory"
        factory="org.apache.activemq.jndi.JNDIReferenceFactory"
        brokerURL="tcp://10.39.95.39:61616"
    brokerName="LocalActiveMQBroker"/>
    <Resource name="jms/letterCountQueue" auth="Container"
        type="org.apache.activemq.command.ActiveMQQueue" description="letterCountQueue"
        factory="org.apache.activemq.jndi.JNDIReferenceFactory" physicalName="letterCountQueue"/>
</Context>

And grails-app/conf/spring/resources.groovy contains

import org.apache.activemq.ActiveMQConnectionFactory
import org.apache.activemq.broker.TransportConnector
import org.apache.activemq.command.ActiveMQQueue
import org.apache.activemq.xbean.XBeanBrokerService

import org.springframework.jms.core.JmsTemplate
import org.springframework.jms.connection.SingleConnectionFactory
import org.springframework.jms.listener.DefaultMessageListenerContainer

beans = {

    jmsBroker(XBeanBrokerService) {
        useJmx = 'false'
        persistent = 'false'
        transportConnectors = [new TransportConnector(uri: new URI('tcp://10.39.95.39:61616'))]
    }

    jmsFactory(ActiveMQConnectionFactory) {
        brokerURL = 'tcp://10.39.95.39:61616'
    }

    notificationQueue(ActiveMQQueue, 'queue.notification')

    jmsTemplate(JmsTemplate) {
        connectionFactory =  { SingleConnectionFactory cf ->
            targetConnectionFactory = ref('jmsFactory')
        }
    }
}

Where have I specified or accepted as default the fact that the broker does not listen for connections outside of localhost? How can I change that?

Thanks very much,
Lee Grey

1

1 Answers

0
votes

i met a similar problem like you. try to modify %ACTIVEMQ_HOME%/conf/activemq.xml, like this:

<transportConnectors>
    <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
    <transportConnector name="openwire" uri="tcp://192.168.1.252:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
</transportConnectors>