google Analytics

Tuesday, October 12, 2010

JBOSS Clustering

JBOSS JMS clustering
----------------------


=============================================================



=============================================================
run.bat -c node1 -g PartitionA -u 239.255.100.100 -b localhost -Djboss.messaging.ServerPeerID=1
run.bat -c node2 -g PartitionB -u 239.255.100.100 -b localhost -Djboss.messaging.ServerPeerID=2

=============================================================



=============================================================
JBoss Messaging clusters JMS queues and topics transparently  across the cluster. Messages sent to
a distributed queue or topic on one node are consumable on other nodes. To designate that a particular destination is clustered, simply set the Clustered attribute in the destination deployment descriptor to true:
=============================================================



=============================================================
<mbean code="org.jboss.jms.server.destination.QueueService"
name="jboss.messaging.destination:service=Queue,name=clusteredQueue"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">
jboss.messaging:service=ServerPeer
</depends>
<depends>jboss.messaging:service=PostOffice</depends>
<attribute name="Clustered">true</attribute>
</mbean>
=============================================================
 

=============================================================
Configuring EJB 3.0 Stateful Session Bean cache
The @org.jboss.ejb3.annotation.CacheConfig Annotation

@Stateful
@Clustered
@CacheConfig(name="new-sfsb-cache")
@Remote(StatefulRemote.class)

Configuring entity caching

<properties>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.use_query_cache" value="true"/>
<property name="hibernate.cache.region.factory_class"
value="org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory"/>
<property name="hibernate.cache.region.jbc2.cachefactory" value="java:CacheManager"/>
<property name="hibernate.cache.region.jbc2.cfg.entity" value="mvcc-entity"/>
<property name="hibernate.cache.region.jbc2.cfg.collection" value="mvcc-entity"/>
</properties>



=============================================================



=============================================================

import javax.persistence.*;
import org.hibernate.annotations.*;
@Entity
@Cache (usage=CacheConcurrencyStrategy.TRANSACTIONAL)
public class ProductEntity implements Serializable {
}
Refer
//deploy\cluster\jboss-cache-manager.sar\META-INF\jboss-cache-configs.xml & jboss-cache-manager-jboss-beans.xml

=============================================================
 

=============================================================
Clustering web applications

Configuring HTTP replication

In web.xml add adding the<distributable /> tag

<web-app>
. . . . .
<distributable />
</web-app>

Refer :jbossweb.deployer\META-INF\war-deployers-jboss-beans.xml

The jboss-web.xml

<!DOCTYPE jboss-web PUBLIC
-//JBoss//DTD Web Application 5.0//EN
http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd>
<jboss-web>
<replication-config>
<cache-name>custom-web-cache</cache-name>
<replication-trigger>SET</replication-trigger>
<replication-granularity>ATTRIBUTE</replication-granularity>
<max-unreplicated-interval>30</max-unreplicated-interval>
<snapshot-mode>instant</snapshot-mode>
<snapshot-interval>1000</snapshot-interval>
</replication-config>
</jboss-web>


=============================================================
 

=============================================================

Jboss  clustering Example
Clustering Web Using Jboss
JMS Clustering Example
Running Jboss in Clustering Mode

--
Anish

No comments:

Post a Comment