|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.boylesoftware.cb2.bcmproviders.http.HttpBCMProvider
Implementation of the BroadcastMessagingProvider
interface which uses HTTP to deliver messages to the members of the
cluster.
This provider implementation requires a special servlet deployed
on every member of the cluster. The servlet is implemented by
ReceiverServlet
class and can be deployed in the
web.xml
file as follows:
... <servlet> <servlet-name>bcmreceiver</servlet-name> <display-name>The CB2 BCM Receiver</display-name> <servlet-class>com.boylesoftware.cb2.bcmproviders.http.ReceiverServlet</servlet-class> <load-on-startup>12</load-on-startup> </servlet> ... <servlet-mapping> <servlet-name>bcmreceiver</servlet-name> <url-pattern>/cb2-bcm</url-pattern> </servlet-mapping> ...
It is not necessary to protect the receiver servlet's URL,
because it always checks that the request comes with the same
password specified by
com.boylesoftware.cb2.broadcastMessaging.http.password
application property. This also means that this property has to have the
same value on all the cluster members. The password is passed as a
request parameter and is clear text though, so for better security
you may consider protecting the URL restricting access, for example,
only to the cluster members' IP addresses.
This implementation uses the following application parameters:
com.boylesoftware.cb2.broadcastMessaging.http.password
-
password, which is used to protect internal cluster communication. This
password must be the same on all cluster members.com.boylesoftware.cb2.broadcastMessaging.http.xxx.url
-
URL of bmcreceiver
servlet of a cluster member. The
xxx
is the member's name, which can be any string. Specify
one such property for each member of the cluster including the local
member itself (so the set of properties is exactly the same on all
cluster members).
Field Summary |
Fields inherited from interface com.boylesoftware.cb2.BroadcastMessagingProvider |
LOG_SUBSYS |
Constructor Summary | |
HttpBCMProvider()
|
Method Summary | |
void |
broadcastMessage(java.lang.String channelName,
java.io.Serializable messageParam)
Send a message to all cluster members. |
void |
destroy()
Destroy the provider. |
void |
init(ApplicationContext appCtx)
Initialize the provider instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HttpBCMProvider()
Method Detail |
public void init(ApplicationContext appCtx) throws ApplicationException
init
in interface BroadcastMessagingProvider
appCtx
- the application context.
ApplicationException
- if a serious error has happened
and the provider cannot be initialized.public void destroy()
destroy
in interface BroadcastMessagingProvider
public void broadcastMessage(java.lang.String channelName, java.io.Serializable messageParam)
broadcastMessage
in interface BroadcastMessagingProvider
channelName
- logical name of the channel, to which the message is
targeted.messageParam
- optional message parameter, may be
null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |