You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Rajalakshmi Raman <ra...@wipro.com> on 2013/11/08 14:19:19 UTC

Not display message in active mq

I tried to send messages from active mq to browser. But it is not even
passing to active mq. I am getting error like this.

Nov 08, 2013 6:38:32 PM
org.springframework.jms.connection.SingleConnectionFacto
ry initConnection
INFO: Established shared JMS Connection: ActiveMQConnection
{id=ID:D-113062837-5
5494-1383916111920-1:1,clientId=null,started=false}

I defined active mq url in application.properties.
broker.url=tcp://localhost:61616
broker.queue=corsoft.BroadcastMessageQueue

cometd.channel=cometd://0.0.0.0:9099/broadcastMessageChannel

In camel context route defined as

<from uri="activemq://queue:{{broker.queue}}"/>
<log message="Incoming Message - distribute via Cometd" loggingLevel="INFO"
/>
			
			<aggregate strategyRef="aggregatorStrategy" completionTimeout="3000">
            <correlationExpression>
                <simple>header.id</simple>
            </correlationExpression>
			<to uri="{{cometd.channel}}" />
			</aggregate>

In POM.xml i added dependency as
<dependency>
			<groupId>org.apache.activemq</groupId>
			<artifactId>activemq-core</artifactId>
			<version>${activemq-version}</version>
		</dependency>


     Plz help me to resolve


Thanks, 
Raji



--
View this message in context: http://camel.465427.n5.nabble.com/Not-display-message-in-active-mq-tp5742853.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Not display message in active mq

Posted by Willem jiang <wi...@gmail.com>.
How did you send the message to ActiveMQ?


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Friday, November 8, 2013 at 9:19 PM, Rajalakshmi Raman wrote:

> I tried to send messages from active mq to browser. But it is not even
> passing to active mq. I am getting error like this.
>  
> Nov 08, 2013 6:38:32 PM
> org.springframework.jms.connection.SingleConnectionFacto
> ry initConnection
> INFO: Established shared JMS Connection: ActiveMQConnection
> {id=ID:D-113062837-5
> 5494-1383916111920-1:1,clientId=null,started=false}
>  
> I defined active mq url in application.properties.
> broker.url=tcp://localhost:61616
> broker.queue=corsoft.BroadcastMessageQueue
>  
> cometd.channel=cometd://0.0.0.0:9099/broadcastMessageChannel
>  
> In camel context route defined as
>  
> <from uri="activemq://queue:{{broker.queue}}"/>
> <log message="Incoming Message - distribute via Cometd" loggingLevel="INFO"
> />
>  
> <aggregate strategyRef="aggregatorStrategy" completionTimeout="3000">
> <correlationExpression>
> <simple>header.id</simple>
> </correlationExpression>
> <to uri="{{cometd.channel}}" />
> </aggregate>
>  
> In POM.xml i added dependency as
> <dependency>
> <groupId>org.apache.activemq</groupId>
> <artifactId>activemq-core</artifactId>
> <version>${activemq-version}</version>
> </dependency>
>  
>  
> Plz help me to resolve
>  
>  
> Thanks,  
> Raji
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Not-display-message-in-active-mq-tp5742853.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Not display message in active mq

Posted by Rajalakshmi Raman <ra...@wipro.com>.
I send message to active mq using Main class

Main class - this will fire automatically generated String messages to the
     * "corsoft.BroadcastMessageQueue" running on the local ActiveMQ broker
(as defined in
     * application.properties).
public class StartDemo {

   public class StartDemo {

    /** Logger. */
    private static Logger LOG = LoggerFactory.getLogger(StartDemo.class);

    /**
     * Main class - this will fire automatically generated String messages
to the
     * "corsoft.BroadcastMessageQueue" running on the local ActiveMQ broker
(as defined in
     * application.properties).
     */
    public static void main(String[] args) throws Exception {

        // Load spring config
        ApplicationContext appContext = new
ClassPathXmlApplicationContext(new String[] {
"application-client-context.xml" });
        BeanFactory factory = (BeanFactory) appContext;
	
        MessageDispatcher dispatcher = (MessageDispatcher)
factory.getBean("messageDispatcher");
		
        for (int x = 0; x < 100; x++) {
            dispatcher.sendMessageObject(createRandomMessage(x));
            Thread.sleep(1000);
        }

        LOG.info("Fin.");

    }
    
    private static  String createRandomMessage(int index) throws IOException
{
        

        StringBuilder sb = new StringBuilder();
        sb.append("
Broadcast Message ");
        sb.append(index);
        sb.append("
");
        sb.append("<p>Received on : ");
        sb.append(new Date());
		System.out.println("Msg gng to Queue");
	    
	 try {
	 
	 DocumentBuilderFactory domFactory = DocumentBuilderFactory
                    .newInstance();
            domFactory.setNamespaceAware(true); 
            DocumentBuilder builder = domFactory.newDocumentBuilder();
           for (File file : new File("D:\\input").listFiles()) 
	{
 	  Document doc = builder.parse(file.getAbsolutePath());
            XPathFactory factory = XPathFactory.newInstance();
            XPath xpath = factory.newXPath();
            XPathExpression expr = xpath.compile("//CD       /*/text()");

            Object result = expr.evaluate(doc, XPathConstants.NODESET);
            NodeList nodes = (NodeList) result;
			
            for (int i = 0; i < nodes.getLength(); i++) {
            System.out.println(nodes.item(i).getNodeValue());
			sb.append(nodes.item(i).getNodeValue());
            }
}
}
	    catch (Exception e) {
	e.printStackTrace();
	
    }

   
	  
        return sb.toString();
        
    }



--
View this message in context: http://camel.465427.n5.nabble.com/Not-display-message-in-active-mq-tp5742853p5742995.html
Sent from the Camel - Users mailing list archive at Nabble.com.