Hi,

You don't need to simulate an httppost, since internally the ajax messaging is still using JMS. (I'm assuming that you're using the activemq-web libraries :)) Are you getting any exceptions? What's your broker url?

Maybe you're running into this issue: http://www.nabble.com/app-to-web-demo-tf2193800.html#a6071268

jefetech wrote:
I've got all my ajax send/receive working, however I need a java program to
be able to send/receive message from the ajax.  Why does the ajax not
receive this? Do I need simulate a httppost instead of this?
            ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory(BROKER_URL);
//Destination destination = client.getSession(); // Create a Connection
            Connection connection = connectionFactory.createConnection();
            connection.start();

            // Create a Session
            Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
            // Create the destination (Topic or Queue)
            Destination destination = session.createTopic(CHANNEL);

            // Create a MessageProducer from the Session to the Topic or
Queue
            MessageProducer producer = session.createProducer(destination);
            producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

            // Create a messages
            String from = Thread.currentThread().getName();
            String text = "<message type='chat' from='" + from + "'>Hello
World Yo!</message>";
            //String text = "Hello world! From: " +
Thread.currentThread().getName() + " : " + this.hashCode();
            TextMessage message = session.createTextMessage(text);

            // Tell the producer to send the message
            System.out.println("Sent message: "+ message.hashCode() + " : "
+ Thread.currentThread().getName());
            producer.send(message);

            // Clean up
            session.close();
            connection.close();

Reply via email to