Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 99805 invoked from network); 5 Sep 2006 22:52:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Sep 2006 22:52:07 -0000 Received: (qmail 71627 invoked by uid 500); 5 Sep 2006 22:52:06 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 71608 invoked by uid 500); 5 Sep 2006 22:52:06 -0000 Mailing-List: contact activemq-users-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-users@geronimo.apache.org Delivered-To: mailing list activemq-users@geronimo.apache.org Received: (qmail 71599 invoked by uid 99); 5 Sep 2006 22:52:06 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Sep 2006 15:52:06 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=RCVD_IN_BL_SPAMCOP_NET X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [64.14.253.182] (HELO mail.exist.com) (64.14.253.182) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Sep 2006 15:52:05 -0700 Received: from [192.168.241.143] ([58.71.13.205]) (authenticated bits=0) by mail.exist.com (8.12.11/8.12.11) with ESMTP id k85MlsWA013347 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 5 Sep 2006 15:47:57 -0700 Message-ID: <44FDFF7C.4000205@exist.com> Date: Wed, 06 Sep 2006 06:51:40 +0800 From: Adrian Co User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: activemq-users@geronimo.apache.org Subject: Re: Java sending message to listening ajax References: <6158009.post@talk.nabble.com> In-Reply-To: <6158009.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 = "Hello > World Yo!"; > //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(); >