main website home
  • About this blog

    This blog features updates, opinions, and technical notes from Caucho engineers about Caucho products, the enterprise Java industry, and PHP. Caucho Technology is the creator of the Resin Application Server and the Quercus PHP in Java engine. A leader in Java performance since 1998, Caucho is a Sun JavaEE licensee with over 9000 customers worldwide.
  • Tags

    ajaxworld bam candi cdi cloud cluster comet configuration deploy devoxx eclipse ejb embedded flash flex google app engine hessian hmtp ioc java ee 6 javaone javazone jms messaging newsletter nyjug osgi php pomegranate quercus resin resin 4.0 REST servlet sfjug silicon valley code camp spring testing training tssjs watchdog webbeans web profile websockets wordpress
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
« Musedot on Quercus and Resin
25,000 connections on Resin 3.2.0 »

BAM client and server

After we realized BAM can be used as a queueing system replacing JMS, we looked at the BAM client and service configuration to simplify it for queueing, and at the same time fix some of the problems associated with JMS messaging. The new BAM configuration is fairly simple. A <bam-service> configures the service, just like Resin’s <ejb-message-bean>. A BamClient class creates a new client.

  1. Create a SimpleBamService to handle the queued messages
  2. Configure the <bam-service>
  3. Send messages using a BamClient

So sending a message looks like the following. “my-message” can be any serializable object, and
“service@localhost” is the JID name of the service.

import com.caucho.bam.BamClient;

BamClient client = new BamClient();

client.message("service@localhost", "my-message");

The service itself implements com.caucho.bam.BamService.

package example;

import com.caucho.bam.SimpleBamService;

public class MyService {
  public void message(String to, String from, java.io.Serializable data)
  {
    System.out.println("DATA: " + data);
  }
}

And the configuration looks like

<web-app xmlns="http://caucho.com/ns/resin">

  <bam-service name="service@localhost" class="example.MyService"/>

</web-app>

This entry was posted on Wednesday, July 23rd, 2008 at 12:29 pm and is filed under Engineering. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.


Caucho Technology is proudly powered by WordPress and Quercus®
Entries (RSS) and Comments (RSS).

  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • BLOG |
  • WIKI 4 |
  • WIKI 3 |
  • Resin: Java Application Server
Copyright (c) 1998-2012 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.
resin® is a cloud optimized, java® application server that supports the java ee webprofile ®