1) Activemq:
Activemq
is a message broker and it is a open source messaging server written in java(like
emailing server) so we need JRE to run it. We keep it
always running similar to apache server (point
2) j).we need to put its Binary files in server(but not in deep folders).it
provides admin panel with password protection to view and manage activities. It
supports cross language client’s (STOMP for PHP) / protocols.
it
is asynchronous.
It
reduces database overheads to make message accessing faster and reduce latency
it is compatible for bulk messaging environment for example thousands of
messages per second, databases tend to fall over. With RDBMS, when you
process a row of data, you typically update a flag indicating that the row has
been processed so that the processing is not repeated.
However,
with Message Queue, you only have to acknowledge a message and the next
consumer will process the next one.
The
difference is the UPDATE statement in a RDBMS is a really slow
operation compared to the acknowledge in activmeq.
It
follows FIFO to read
messages.
Active MQ has great scheduler support (via
GUI) that means you can schedule your message to be
delivered at a particular time.
There
are also other messaging queues IBMMQ, RabbitMQ.
Activemq real world use cases (remanded link):
http://stackoverflow.com/questions/1035949/real-world-use-of-jms-message-queues
For more study:
2) installation
activemq
a) every
thing should be with in 64 bit with this installation (ex:XAMPP,JRE,
php_stomp.dll),copy past files in server and inside bin/win64 dir run command
activemq to run activemq server, follow
the instruction.
b) download
activemq:
c) enable
open_ssl in php.ini
d) JRE
required
e) Set
environment variable(JAVA_HOME with java
dir path):
f) Make
shore following is inside <transportConnectors></transportConnectors>
In conf/activemq.xml yet, to enable STOMP, it is
default:
<transportConnector
name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
g) Do
following with activemq downloaded folder(amq) ,trigger command activemq inside
amq dir to run server as bellow:
h) Test
installation by using provided url(default) at time of running server:
http://localhost:8161/
i) Default
username and password is admin/admin we may reset it from php.ini.
3)Install
stomp extension for php:
a) download
dll file for stomp extension :
a.1) download
a.2) unzip and copy past
php_stomp.dll file in’ xampp/php/ext’
folder
b) Add
‘ extension=php_stomp.dll’ in php.ini
file
c)
Restart xampp and check phpinfo():its working
NOTE: you may skip STOMP installation and include
stomp files if you have problem on linux.
4) producer
is a sender, server side code and consumer is a receiver of that message,
client side code,it support both coding pattern, Object oriented style
and procedural style, we will use Object oriented style .
consumer(receiver.php)
should be asynchronous (and always running) for testing run it from terminal.
http://blog.gigavoice.com/asynchronous-processing-with-php/
Test
example:
1) initialy no topic(category) found in topic tab:
2) after exicution of producer code new topic ‘ event’ created:
4) event queue created:
now one message
found in event queue
5)we make test of send/ receive message via:
CHECK VIDEO TUTORIAL OF ALL ABOVE STAPES:
Comments
Post a Comment