| |||||||||||||||||||||||||||
Find this tutorial in: /usr/local/resin/webapps/resin-doc/jms/tutorial/php-queue-send
Try the Tutorial
Quercus offers a simplified messaging interface built upon JMS. This functionality makes it possible to send and receive messages using either the Resin JMS implementation or any other messaging service with a JMS implementation. Many features of JMS are designed for message-driven services which make sense in the Java world, but are not appropriate for PHP. This tutorial focuses on sending messages.
In this example, the script checks a POST variable "message" and if it is set, sends the value of that variable to a JMS queue. A Message Driven Bean (MDB) receives these messages and records them. The record is displayed by a servlet.
The programming model of the Quercus JMS interface is first to create a connection to a queue by instantiating a JMSQueue object. To create a JMSQueue object, pass in the JNDI name of the JMS queue to be used. JMSQueue objects have two methods: send() and receive(). This example shows that using send() is as simple as passing in a PHP value.
JMS requires that two resources be set up: A
ConnectionFactory and a Queue. Both are
configured in
The example above uses the queue jms/Queue.
The complete configuration is in
|