camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajalakshmi Raman <rajalakshmi.ra...@wipro.com>
Subject Re: Not display message in active mq
Date Mon, 11 Nov 2013 03:43:44 GMT
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.

Mime
View raw message