Hi Sinthuja, Thanks a lot. It is working as expected now.
Regards GayanD On Wed, Oct 22, 2014 at 9:29 PM, Sinthuja Ragendran <sinth...@wso2.com> wrote: > Hi, > > > > On Wed, Oct 22, 2014 at 11:52 AM, Manoj Gunawardena <man...@wso2.com> > wrote: > >> Hi Gayan, >> >> I think the bamServerURL format you are passing is not correct. It >> should be pass to the DataPublisherUtil.getReceiverGroups method with >> following format. >> * {*tcp://192.168.16.2:7614},{tcp://192.168.16.2:7624}*.* Each host >> should enclose with curly brackets. >> >> > No, this url should be used if you need to send an event to both URLs. > > @Gayan: The below code line should pass 'false' in you want loadbalancing > feature, with failover. If you need only active/passive setup (ie, failover > only), you need to pass true. Hence please correct that and try again. > > > > *ReceiverGroup group = new ReceiverGroup(dataPublisherHolders, true);* > Thanks, > Sinthuja. > > >> Pls refer >> >> http://mohanadarshan.wordpress.com/2013/05/04/load-balancing-data-publisher-to-bamcep-example-code/ >> Thanks >> >> On Wed, Oct 22, 2014 at 8:34 PM, Gayan Dhanushka <gay...@wso2.com> wrote: >> >>> Hi Sinthuja, >>> >>> I tested with two BAM servers pointing to its own cassandra (not >>> clustered). I was not able to see the load balancing scenario where nearly >>> equal amount of events are published into respective BAM nodes. >>> >>> Following is the code that I have used. Please correct me if I have done >>> something wrong. >>> >>> Urls defined in appfactory.xml >>> >>> * tcp://192.168.16.2:7614 >>> <http://192.168.16.2:7614>,tcp://192.168.16.2:7624 >>> <http://192.168.16.2:7624>* >>> >>> code for preparing receiver groups >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> * AppFactoryConfiguration config = AppFactoryUtil >>> .getAppfactoryConfiguration(); String EnableStatPublishing = >>> config >>> .getFirstProperty("BAM.EnableStatPublishing"); String >>> bamServerURL = config.getFirstProperty("BAM.BAMServerURL"); >>> String bamServerUserName = config >>> .getFirstProperty("BAM.BAMUserName"); String bamServerPassword = >>> config .getFirstProperty("BAM.BAMPassword"); >>> AgentConfiguration agentConfiguration = new >>> AgentConfiguration(); Agent agent = new >>> Agent(agentConfiguration); ArrayList<ReceiverGroup> >>> allReceiverGroups = new ArrayList<ReceiverGroup>(); >>> ArrayList<String> receiverGroupUrls = >>> DataPublisherUtil.getReceiverGroups(bamServerURL); for (String >>> aReceiverGroupURL : receiverGroupUrls) { >>> ArrayList<DataPublisherHolder> dataPublisherHolders = new >>> ArrayList<DataPublisherHolder>(); String[] urls = >>> aReceiverGroupURL.split(","); for (String aUrl : urls) >>> { DataPublisherHolder aNode = new >>> DataPublisherHolder(null, aUrl.trim(), bamServerUserName, >>> bamServerPassword); >>> dataPublisherHolders.add(aNode); } >>> ReceiverGroup group = new ReceiverGroup(dataPublisherHolders, >>> true); allReceiverGroups.add(group); } >>> loadBalancingDataPublisher = new >>> LoadBalancingDataPublisher(allReceiverGroups, agent);* >>> >>> Method for event publishing >>> >>> >>> >>> >>> *public void publishEvents(Event event, String Stream, String >>> version) throws AgentException, InterruptedException >>> { loadBalancingDataPublisher.publish(Stream, version, >>> event); }* >>> >>> Thanks >>> GayanD >>> >>> >>> >>> On Wed, Oct 22, 2014 at 7:32 PM, Sinthuja Ragendran <sinth...@wso2.com> >>> wrote: >>> >>>> Hi gayan, >>>> >>>> In order to verify the loadbalancing of events in a round robin manner, >>>> you can have two BAM nodes pointing to its own cassandra instance (not >>>> clustered), and send the events to those BAM nodes. If your client is >>>> configured correctly for load balancing scenario, then you will see each >>>> bam nodes will have nearly equal amount of events stored in its respective >>>> BAM nodes. This is just for testing purpose to verify, but of course in >>>> real case cassandra will be clustered, hence finally even though the load >>>> is balanced within receiver nodes it stores in the same cassandra cluster, >>>> hence it's not observable from outside. >>>> >>>> Thanks, >>>> Sinthuja. >>>> >>>> On Wed, Oct 22, 2014 at 4:53 AM, Gayan Dhanushka <gay...@wso2.com> >>>> wrote: >>>> >>>>> Hi all, >>>>> >>>>> I have been trying to move the AsyncDataPublisher used in App Factory >>>>> to LoadBalancingDataPublisher to cater load balancing and failover. Even >>>>> though [1] describes that it sends data to available receiver nodes in a >>>>> round robin manner, I was only able to observe the failover scenario. >>>>> >>>>> Can somebody please explain ? >>>>> >>>>> [1] >>>>> https://docs.wso2.com/display/BAM240/Setting+up+Multi+Receiver+and+Load+Balancing+Data+Agent#SettingupMultiReceiverandLoadBalancingDataAgent-Loadbalancingconfigurations >>>>> >>>>> Thanks >>>>> GayanD >>>>> >>>>> -- >>>>> Gayan Dhanuska >>>>> Software Engineer >>>>> http://wso2.com/ >>>>> Lean Enterprise Middleware >>>>> >>>>> Mobile >>>>> 071 666 2327 >>>>> >>>>> Office >>>>> Tel : 94 11 214 5345 >>>>> Fax : 94 11 214 5300 >>>>> >>>>> Twitter : https://twitter.com/gayanlggd >>>>> >>>> >>>> >>>> >>>> -- >>>> *Sinthuja Rajendran* >>>> Senior Software Engineer <http://wso2.com/> >>>> WSO2, Inc.:http://wso2.com >>>> >>>> Blog: http://sinthu-rajan.blogspot.com/ >>>> Mobile: +94774273955 >>>> >>>> >>>> >>> >>> >>> -- >>> Gayan Dhanuska >>> Software Engineer >>> http://wso2.com/ >>> Lean Enterprise Middleware >>> >>> Mobile >>> 071 666 2327 >>> >>> Office >>> Tel : 94 11 214 5345 >>> Fax : 94 11 214 5300 >>> >>> Twitter : https://twitter.com/gayanlggd >>> >>> _______________________________________________ >>> Dev mailing list >>> Dev@wso2.org >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> Manoj Gunawardena >> Tech Lead >> WSO2, Inc.: http://wso2.com >> lean.enterprise.middleware >> Mobile : +94 77 2291643 >> > > > > -- > *Sinthuja Rajendran* > Senior Software Engineer <http://wso2.com/> > WSO2, Inc.:http://wso2.com > > Blog: http://sinthu-rajan.blogspot.com/ > Mobile: +94774273955 > > > -- Gayan Dhanuska Software Engineer http://wso2.com/ Lean Enterprise Middleware Mobile 071 666 2327 Office Tel : 94 11 214 5345 Fax : 94 11 214 5300 Twitter : https://twitter.com/gayanlggd
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev