You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 17 Members of 9438 |
<dependency>
<groupId>org.jboss.seam.jms</groupId>
<artifactId>seam-jms</artifactId>
<version>${seam.jms.version}</version>
</dependency>
Seam extends the CDI programming model into the messaging world by allowing you to inject JMS resources into your beans. Further, Seam bridges the CDI event bus over JMS; this gives you the benefits of CDI-style type-safety for inter-application communication.
| Name | Organization | Role | Hometown (Time zone) |
|---|---|---|---|
| Jordan Ganoff | - | Module lead | Orlando, FL, USA (UTC-05) |
| Dan Allen | JBoss, by Red Hat | Advisor, contributor | Laurel, MD, USA (UTC-05) |
The general goals can be divided into two categories: injection of JMS resources and forwarding of events.
| Version | Time frame | Focus |
|---|---|---|
| 3.0.0.Alpha1 | 2010-05-14 |
|
| 3.0.0.Alpha2 | TBD |
|
| 3.0.0.Alpha-NEXT | TBD |
|
| 3.0.0.Beta1 | TBD |
There is currently no way to configure the ConnectionFactory URL or JNDI name Seam JMS uses; it is hardcoded as ConnectionFactory
. That being said, if you're testing with Glassfish V3 you should define a ConnectionFactory by that name as follows. Thanks Dan Allen for this tip:
The prerequisite for using this on GlassFish V3 is to define a ConnectionFactory named ConnectionFactory
. You can either do this through the Admin Console or this asadmin command:
Admin Console:
Resources > JMS Resources > Connection Factories New... Pool Name: ConnectionFactory Resource Type: javax.jms.ConnectionFactory OK (Accept all other defaults)
asadmin:
$GLASSFISH_HOME/bin/asadmin create-jms-resource --restype javax.jms.ConnectionFactory ConnectionFactory
That will enable the internal resource injection that Seam JMS uses:
@Resource("ConnectionFactory")
private ConnectionFactory cf;
Goal: Injection should be simple, intuitive, and type-safe.
@Qualifier
@Retention(RUNTIME)
@Target({ PARAMETER, METHOD, FIELD })
@JmsDestination(jndiName = "/jms/my-topic")
public @interface MyTopic {}
@Inject @MyTopic Topic t;
SEAMJMS-2: Implement original design from spec draft from 20090520 (Page 41) where we use the producer field pattern to provide access JMS artifacts. This is much more flexible, as it allows the use of @Alternative etc:
@Resource(name="java:global/env/jms/PaymentQueue") @Produces @PaymentProcessor Queue paymentQueue;
@Resource(name="java:global/env/jms/Prices") @Produces @Prices Topic pricesTopic;
Goal: Provide a mechanism to send/receive events transparently over JMS.
Bridging JMS messages and CDI events can also be done by annotated a method @EventRouting and returning Collection<Route> or Route:
@Inject EventBridge bridge;
@EventRouting
public Route eventRoutingConfig()
{
return bridge.createRoute(EGRESS, Object.class).addQualifier(SPECIAL).connectTo(Topic.class, myTopic);
}
@EventRouting
public Collection<Route> manyRoutingConfigs()
{
return Arrays.asList(
bridge.createRoute(EGRESS, MyEvent.class).connectTo(Queue.class, myQueue),
bridge.createRoute(EGRESS, LogginEvent.class).connectTo(Topic.class, eventTopic));
}
@Produces @EventRouting List<Route> ...
@Observes
interface JMSMapping
{
void myMapping(@Observes @SomeQualifier SomeType type, @MyTopic Topic topic);
}