[seam-commits] Seam SVN: r12766 - in modules/jms/trunk: api/src/main/java/org/jboss/seam/jms/bridge and 5 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu May 20 19:58:18 EDT 2010
Author: jganoff
Date: 2010-05-20 19:58:16 -0400 (Thu, 20 May 2010)
New Revision: 12766
Added:
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
Removed:
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java
modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/simple/
Modified:
modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java
modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java
Log:
EventBridge api and egress routing implementation
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge)
Deleted: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.lang.reflect.Type;
-
-/**
- * Facilitates bridging of events between CDI and a messaging system.
- *
- * @author Jordan Ganoff
- *
- */
-public interface EventBridge
-{
- /**
- * Creates a routing for the provided payload (event) type.
- *
- * @param type Type or direction of routing.
- * @param payloadType Payload type to route. This is the event type we wish
- * to observe events for.
- * @return
- */
- public Route createRoute(RouteType type, Type payloadType);
-}
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java)
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventBridge.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.reflect.Type;
+
+/**
+ * Facilitates bridging of events between CDI and a messaging system.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public interface EventBridge
+{
+ /**
+ * Creates a routing for the provided payload (event) type.
+ *
+ * @param type Type or direction of routing.
+ * @param payloadType Payload type to route. This is the event type we wish
+ * to observe events for.
+ * @return
+ */
+ public Route createRoute(RouteType type, Type payloadType);
+}
Deleted: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * <p>
- * Identifies an Event Routing configuration method. May be applied to a method
- * of a bean class.
- * </p>
- *
- * <p>
- * The method may return {@link EventBridge} or {@code List<}{@link EventBridge}{@code>}.
- * </p>
- *
- * <pre>
- * @Inject
- * EventBridge bridge;
- *
- * @EventRouting
- * public static Route eventRoutingConfig()
- * {
- * return bridge.createRoute(EGRESS, Object.class).addQualifier(SPECIAL).connectTo(Topic.class, myTopic);
- * }
- * </pre>
- *
- * @author Jordan Ganoff
- */
- at Target( { METHOD })
- at Retention(RUNTIME)
- at Documented
-public @interface EventRouting
-{
-}
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java)
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/EventRouting.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * <p>
+ * Identifies an Event Routing configuration method. May be applied to a method
+ * of a bean class.
+ * </p>
+ *
+ * <p>
+ * The method may return {@link EventBridge} or {@code List<}{@link EventBridge}{@code>}.
+ * </p>
+ *
+ * <pre>
+ * @Inject
+ * EventBridge bridge;
+ *
+ * @EventRouting
+ * public static Route eventRoutingConfig()
+ * {
+ * return bridge.createRoute(EGRESS, Object.class).addQualifier(SPECIAL).connectTo(Topic.class, myTopic);
+ * }
+ * </pre>
+ *
+ * @author Jordan Ganoff
+ */
+ at Target( { METHOD })
+ at Retention(RUNTIME)
+ at Documented
+public @interface EventRouting
+{
+}
Deleted: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/Route.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.jms.Destination;
-
-/**
- * Routing configuration between CDI and JMS.
- *
- * @author Jordan Ganoff
- *
- */
-public interface Route
-{
-
- /**
- * Connect this route to a destination. Multiple destinations may be defined.
- *
- * @param <D> Destination type
- * @param d Destination type (e.g. javax.jms.Topic)
- * @param destination Destination to connect this route to
- * @return this
- */
- public <D extends Destination> Route connectTo(Class<D> d, D destination);
-
- /**
- * Apply the qualifiers listed to this route.
- *
- * @param qualifiers Qualifiers for the payload type
- * @return this
- */
- public Route addQualifiers(Annotation... qualifiers);
-
- /**
- * @return the routing type
- */
- public RouteType getType();
-
- /**
- * @return the type this route routes
- */
- public Type getPayloadType();
-
- /**
- * @return the qualifiers
- */
- public Set<Annotation> getQualifiers();
-
- /**
- * @return The destinations involved in this routing
- */
- public Set<? extends Destination> getDestinations();
-}
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/Route.java)
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/Route.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.jms.Destination;
+
+/**
+ * Routing configuration between CDI and JMS.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public interface Route
+{
+
+ /**
+ * Connect this route to a destination. Multiple destinations may be defined.
+ *
+ * @param <D> Destination type
+ * @param d Destination type (e.g. javax.jms.Topic)
+ * @param destination Destination to connect this route to
+ * @return this
+ */
+ public <D extends Destination> Route connectTo(Class<D> d, D destination);
+
+ /**
+ * Apply the qualifiers listed to this route.
+ *
+ * @param qualifiers Qualifiers for the payload type
+ * @return this
+ */
+ public Route addQualifiers(Annotation... qualifiers);
+
+ /**
+ * @return the routing type
+ */
+ public RouteType getType();
+
+ /**
+ * @return the type this route routes
+ */
+ public Type getPayloadType();
+
+ /**
+ * @return the qualifiers
+ */
+ public Set<Annotation> getQualifiers();
+
+ /**
+ * @return The destinations involved in this routing
+ */
+ public Set<? extends Destination> getDestinations();
+}
Deleted: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java
===================================================================
--- modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-/**
- * All valid {@link Route} types.
- *
- * @author Jordan Ganoff
- *
- */
-public enum RouteType
-{
- /**
- * Inbound route. Any route defined as INGRESS will listen for objects
- * delivered to the registered destinations and fire events for all that
- * match the configuration as defined by the route.
- */
- INGRESS,
-
- /**
- * Outbound route. Any route defined as EGRESS will forward CDI events that
- * match the configuration as defined by the route to the registered
- * destinations.
- */
- EGRESS;
-}
Copied: modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java (from rev 12765, modules/jms/branches/eventbridge/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java)
===================================================================
--- modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java (rev 0)
+++ modules/jms/trunk/api/src/main/java/org/jboss/seam/jms/bridge/RouteType.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+/**
+ * All valid {@link Route} types.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public enum RouteType
+{
+ /**
+ * Inbound route. Any route defined as INGRESS will listen for objects
+ * delivered to the registered destinations and fire events for all that
+ * match the configuration as defined by the route.
+ */
+ INGRESS,
+
+ /**
+ * Outbound route. Any route defined as EGRESS will forward CDI events that
+ * match the configuration as defined by the route to the registered
+ * destinations.
+ */
+ EGRESS;
+}
Deleted: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/BridgedObserver.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Reception;
-import javax.enterprise.event.TransactionPhase;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.ObserverMethod;
-import javax.inject.Named;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Observer Method to observe events and forward (bridge) them over JMS.
- *
- * @author Jordan Ganoff
- */
- at Named
- at ApplicationScoped
-public class BridgedObserver implements ObserverMethod<Object>
-{
- private Logger log = LoggerFactory.getLogger(getClass());
-
- private BeanManager bm;
- private JmsForwarding config;
-
- public BridgedObserver(BeanManager bm, JmsForwarding config)
- {
- this.bm = bm;
- this.config = config;
- }
-
- public Class<?> getBeanClass()
- {
- return null;
- }
-
- public Set<Annotation> getObservedQualifiers()
- {
- return config.getQualifiers();
- }
-
- public Type getObservedType()
- {
- return config.getEventType();
- }
-
- public Reception getReception()
- {
- return Reception.ALWAYS;
- }
-
- public TransactionPhase getTransactionPhase()
- {
- return TransactionPhase.AFTER_SUCCESS;
- }
-
- public void notify(Object evt)
- {
- // FIXME Include qualifiers once CDI 1.0 MR is complete and
- // notify(Event, Set<Annotation>) is added
- forwardEvent(evt, null);
- }
-
- private void forwardEvent(Object event, Set<Annotation> qualifiers)
- {
- Set<Bean<?>> beans = bm.getBeans(Session.class);
- Bean<?> bean = bm.resolve(beans);
- Session s = (Session) bm.getReference(bean, Session.class, bm.createCreationalContext(bean));
- try
- {
- for (Destination d : config.getDestinations())
- {
- try
- {
- Message m = s.createObjectMessage((Serializable) event);
- // Safe to create producers here always? In an app server these
- // should be cached via JCA managed connection factory but what
- // about other environments?
- s.createProducer(d).send(m);
- }
- catch (JMSException ex)
- {
- log.error("Unable to forward event", ex);
- }
- }
- }
- finally
- {
- try
- {
- s.close();
- }
- catch (JMSException ex)
- {
- log.error("Unable to close session", ex);
- }
- }
- }
-}
Modified: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/Seam3JmsExtension.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -21,16 +21,23 @@
*/
package org.jboss.seam.jms;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.Extension;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import org.jboss.seam.jms.bridge.EgressRoutingObserver;
+import org.jboss.seam.jms.bridge.EventRouting;
+import org.jboss.seam.jms.bridge.Route;
import org.jboss.seam.jms.impl.wrapper.JmsAnnotatedTypeWrapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,27 +51,65 @@
{
private static final Logger log = LoggerFactory.getLogger(Seam3JmsExtension.class);
- public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm)
+ private Set<AnnotatedMethod<?>> eventRoutingRegistry = new HashSet<AnnotatedMethod<?>>();
+
+ public void buildRoutes(@Observes final AfterBeanDiscovery abd, final BeanManager bm)
{
- Set<Bean<?>> configuration = bm.getBeans(JmsForwarding.class);
-
- if(configuration == null || configuration.isEmpty())
+ for (AnnotatedMethod<?> m : eventRoutingRegistry)
{
- log.info("No {} registered. Event forwarding disabled.", JmsForwarding.class.getSimpleName());
- } else
- {
- for(Bean<?> c : configuration)
+ Type beanType = m.getDeclaringType().getBaseType();
+ Set<Bean<?>> configBeans = bm.getBeans(beanType);
+ for (Bean<?> configBean : configBeans)
{
- log.info("Creating {} for configuration {}", BridgedObserver.class.getSimpleName(), c);
- CreationalContext<?> context = bm.createCreationalContext(c);
- // TODO Verify configuration for correctness (e.g. getQualifiers() must contain only @Qualifier annotations)
- JmsForwarding config = JmsForwarding.class.cast(bm.getReference(c, JmsForwarding.class, context));
- BridgedObserver b = new BridgedObserver(bm, config);
- abd.addObserverMethod(b);
+ CreationalContext<?> context = bm.createCreationalContext(configBean);
+ Object config = null;
+ try
+ {
+ Object bean = bm.getReference(configBean, beanType, context);
+ config = m.getJavaMember().invoke(bean);
+ } catch (Exception ex)
+ {
+ abd.addDefinitionError(new IllegalArgumentException(EventRouting.class.getSimpleName() + " could not be loaded from bean " + beanType + ": " + ex.getMessage(), ex));
+ }
+ log.debug("Building " + Route.class.getSimpleName() + "s from " + beanType);
+ if (config != null)
+ {
+ if (Collection.class.isAssignableFrom(config.getClass()))
+ {
+ Collection<?> routes = Collection.class.cast(config);
+ for (Object route : routes)
+ {
+ if(route == null || !Route.class.isAssignableFrom(route.getClass()))
+ {
+ abd.addDefinitionError(new IllegalArgumentException("Non-" + Route.class.getSimpleName() + " found when loading " + EventRouting.class.getSimpleName() + " from " + beanType + ": " + route));
+ }
+ createRoute(abd, bm, (Route) route);
+ }
+ } else if(Route.class.isAssignableFrom(config.getClass()))
+ {
+ createRoute(abd, bm, Route.class.cast(config));
+ } else
+ {
+ abd.addDefinitionError(new IllegalArgumentException(EventRouting.class + " methods must return a " + Collection.class + "<? extends " + Route.class + "> or " + Route.class + " directly."));
+ }
+ }
}
}
}
+ private void createRoute(final AfterBeanDiscovery abd, final BeanManager bm, final Route route)
+ {
+ switch(route.getType())
+ {
+ case EGRESS:
+ abd.addObserverMethod(new EgressRoutingObserver(bm, route));
+ log.debug("Built " + route);
+ break;
+ default:
+ abd.addDefinitionError(new IllegalArgumentException("Unsupported routing type: " + route.getType()));
+ }
+ }
+
public <X> void decorateAnnotatedType(@Observes ProcessAnnotatedType<X> pat)
{
/**
@@ -72,4 +117,15 @@
*/
pat.setAnnotatedType(JmsAnnotatedTypeWrapper.decorate(pat.getAnnotatedType()));
}
+
+ public void registerEventRouting(@Observes ProcessAnnotatedType<?> pat)
+ {
+ for(AnnotatedMethod<?> m : pat.getAnnotatedType().getMethods())
+ {
+ if(m.isAnnotationPresent(EventRouting.class))
+ {
+ eventRoutingRegistry.add(m);
+ }
+ }
+ }
}
Copied: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge (from rev 12765, modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge)
Deleted: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,135 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.io.Serializable;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Reception;
-import javax.enterprise.event.TransactionPhase;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.ObserverMethod;
-import javax.inject.Named;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Forwards CDI events that match the provided {@link Route} configuration to
- * the configured destinations.
- *
- * @author Jordan Ganoff
- *
- */
- at Named
- at ApplicationScoped
-public class EgressRoutingObserver implements ObserverMethod<Object>
-{
- private Logger log;
- private BeanManager bm;
- private Route routing;
-
- public EgressRoutingObserver(BeanManager bm, Route routing)
- {
- this.bm = bm;
- this.routing = routing;
- log = LoggerFactory.getLogger(routing.getClass());
- }
-
- public Class<?> getBeanClass()
- {
- return null;
- }
-
- public Set<Annotation> getObservedQualifiers()
- {
- return routing.getQualifiers();
- }
-
- public Type getObservedType()
- {
- return routing.getPayloadType();
- }
-
- public Reception getReception()
- {
- return Reception.ALWAYS;
- }
-
- public TransactionPhase getTransactionPhase()
- {
- return TransactionPhase.AFTER_SUCCESS;
- }
-
- public void notify(Object evt)
- {
- // FIXME Include qualifiers once CDI 1.0 MR is complete and
- // notify(Event, Set<Annotation>) is added
- forwardEvent(evt, null);
- }
-
- private void forwardEvent(Object event, Set<Annotation> qualifiers)
- {
- // TODO Allow session to be configured
- Set<Bean<?>> beans = bm.getBeans(Session.class);
- Bean<?> bean = bm.resolve(beans);
- Session s = (Session) bm.getReference(bean, Session.class, bm.createCreationalContext(bean));
- try
- {
- for (Destination d : routing.getDestinations())
- {
- log.info("Routing event {} over destination {}", event, d);
- try
- {
- Message m = s.createObjectMessage((Serializable) event);
- // Safe to create producers here always? In an app server these
- // should be cached via JCA managed connection factory but what
- // about other environments?
- s.createProducer(d).send(m);
- }
- catch (JMSException ex)
- {
- log.error("Unable to forward event", ex);
- }
- }
- }
- finally
- {
- try
- {
- s.close();
- }
- catch (JMSException ex)
- {
- log.error("Unable to close session", ex);
- }
- }
- }
-}
Copied: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java)
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java (rev 0)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/EgressRoutingObserver.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.inject.Named;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Forwards CDI events that match the provided {@link Route} configuration to
+ * the configured destinations.
+ *
+ * @author Jordan Ganoff
+ *
+ */
+ at Named
+ at ApplicationScoped
+public class EgressRoutingObserver implements ObserverMethod<Object>
+{
+ private Logger log;
+ private BeanManager bm;
+ private Route routing;
+
+ public EgressRoutingObserver(BeanManager bm, Route routing)
+ {
+ this.bm = bm;
+ this.routing = routing;
+ log = LoggerFactory.getLogger(routing.getClass());
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return null;
+ }
+
+ public Set<Annotation> getObservedQualifiers()
+ {
+ return routing.getQualifiers();
+ }
+
+ public Type getObservedType()
+ {
+ return routing.getPayloadType();
+ }
+
+ public Reception getReception()
+ {
+ return Reception.ALWAYS;
+ }
+
+ public TransactionPhase getTransactionPhase()
+ {
+ return TransactionPhase.AFTER_SUCCESS;
+ }
+
+ public void notify(Object evt)
+ {
+ // FIXME Include qualifiers once CDI 1.0 MR is complete and
+ // notify(Event, Set<Annotation>) is added
+ forwardEvent(evt, null);
+ }
+
+ private void forwardEvent(Object event, Set<Annotation> qualifiers)
+ {
+ // TODO Allow session to be configured
+ Set<Bean<?>> beans = bm.getBeans(Session.class);
+ Bean<?> bean = bm.resolve(beans);
+ Session s = (Session) bm.getReference(bean, Session.class, bm.createCreationalContext(bean));
+ try
+ {
+ for (Destination d : routing.getDestinations())
+ {
+ log.info("Routing event {} over destination {}", event, d);
+ try
+ {
+ Message m = s.createObjectMessage((Serializable) event);
+ // Safe to create producers here always? In an app server these
+ // should be cached via JCA managed connection factory but what
+ // about other environments?
+ s.createProducer(d).send(m);
+ }
+ catch (JMSException ex)
+ {
+ log.error("Unable to forward event", ex);
+ }
+ }
+ }
+ finally
+ {
+ try
+ {
+ s.close();
+ }
+ catch (JMSException ex)
+ {
+ log.error("Unable to close session", ex);
+ }
+ }
+ }
+}
Deleted: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.lang.reflect.Type;
-
-/**
- * Default JMS Event Bridge
- *
- * @author Jordan Ganoff
- *
- */
-public class JmsEventBridge implements EventBridge
-{
- public Route createRoute(RouteType type, Type payloadType)
- {
- return new RouteImpl(type, payloadType);
- }
-}
Copied: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java)
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java (rev 0)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/JmsEventBridge.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.reflect.Type;
+
+/**
+ * Default JMS Event Bridge
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public class JmsEventBridge implements EventBridge
+{
+ public Route createRoute(RouteType type, Type payloadType)
+ {
+ return new RouteImpl(type, payloadType);
+ }
+}
Deleted: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.bridge;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.inject.Qualifier;
-import javax.jms.Destination;
-
-/**
- * JMS Event Bridge Routing
- *
- * @author Jordan Ganoff
- *
- */
-public class RouteImpl implements Route
-{
- private RouteType type;
- private Type payloadType;
- private Set<Annotation> qualifiers;
- private Set<Destination> destinations;
-
- public RouteImpl(RouteType type, Type payloadType)
- {
- this.type = type;
- this.payloadType = payloadType;
- qualifiers = new HashSet<Annotation>();
- destinations = new HashSet<Destination>();
- }
-
- public Route addQualifiers(Annotation... q)
- {
- if (q != null)
- {
- for (int i = 0; i < q.length; i++)
- {
- Annotation qualifier = q[i];
- if (!qualifier.annotationType().isAnnotationPresent(Qualifier.class))
- {
- throw new IllegalArgumentException("not a qualifier: " + qualifier);
- }
- qualifiers.add(q[i]);
- }
- }
- return this;
- }
-
- public <D extends Destination> Route connectTo(java.lang.Class<D> d, D destination)
- {
- destinations.add(Destination.class.cast(destination));
- return this;
- };
-
- public RouteType getType()
- {
- return type;
- }
-
- public Type getPayloadType()
- {
- return payloadType;
- }
-
- public Set<Annotation> getQualifiers()
- {
- return qualifiers;
- }
-
- public Set<? extends Destination> getDestinations()
- {
- return destinations;
- }
-}
Copied: modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java)
===================================================================
--- modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java (rev 0)
+++ modules/jms/trunk/impl/src/main/java/org/jboss/seam/jms/bridge/RouteImpl.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.bridge;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.inject.Qualifier;
+import javax.jms.Destination;
+
+/**
+ * JMS Event Bridge Routing
+ *
+ * @author Jordan Ganoff
+ *
+ */
+public class RouteImpl implements Route
+{
+ private RouteType type;
+ private Type payloadType;
+ private Set<Annotation> qualifiers;
+ private Set<Destination> destinations;
+
+ public RouteImpl(RouteType type, Type payloadType)
+ {
+ this.type = type;
+ this.payloadType = payloadType;
+ qualifiers = new HashSet<Annotation>();
+ destinations = new HashSet<Destination>();
+ }
+
+ public Route addQualifiers(Annotation... q)
+ {
+ if (q != null)
+ {
+ for (int i = 0; i < q.length; i++)
+ {
+ Annotation qualifier = q[i];
+ if (!qualifier.annotationType().isAnnotationPresent(Qualifier.class))
+ {
+ throw new IllegalArgumentException("not a qualifier: " + qualifier);
+ }
+ qualifiers.add(q[i]);
+ }
+ }
+ return this;
+ }
+
+ public <D extends Destination> Route connectTo(java.lang.Class<D> d, D destination)
+ {
+ destinations.add(Destination.class.cast(destination));
+ return this;
+ };
+
+ public RouteType getType()
+ {
+ return type;
+ }
+
+ public Type getPayloadType()
+ {
+ return payloadType;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ public Set<? extends Destination> getDestinations()
+ {
+ return destinations;
+ }
+}
Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyQueue.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -21,14 +21,9 @@
*/
package org.jboss.seam.jms.test;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
import javax.inject.Qualifier;
Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/MyTopic.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -21,14 +21,9 @@
*/
package org.jboss.seam.jms.test;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
import javax.inject.Qualifier;
Modified: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/Util.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -25,6 +25,7 @@
import org.jboss.seam.jms.Seam3JmsExtension;
import org.jboss.seam.jms.annotations.JmsSession;
+import org.jboss.seam.jms.bridge.Route;
import org.jboss.seam.jms.impl.inject.ConnectionProducer;
import org.jboss.seam.jms.impl.wrapper.JmsAnnotatedTypeWrapper;
import org.jboss.shrinkwrap.api.ArchivePaths;
@@ -43,6 +44,7 @@
archive.addPackage(JmsSession.class.getPackage());
archive.addPackage(ConnectionProducer.class.getPackage());
archive.addPackage(JmsAnnotatedTypeWrapper.class.getPackage());
+ archive.addPackage(Route.class.getPackage());
archive.addManifestResource(new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));
archive.addServiceProvider(Extension.class, Seam3JmsExtension.class);
archive.addManifestResource("topic_T-service.xml");
Added: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/JmsEventBridgeTest.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.jms.bridge.EventBridge;
+import org.jboss.seam.jms.bridge.Route;
+import org.jboss.seam.jms.bridge.RouteType;
+import org.jboss.seam.jms.test.Util;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class JmsEventBridgeTest
+{
+
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return Util.createDeployment(JmsEventBridgeTest.class);
+ }
+
+ @Inject Instance<EventBridge> bridge;
+
+ @Test
+ public void injectBridge()
+ {
+ Assert.assertNotNull(bridge.get());
+ }
+
+ @Test
+ public void createRoute()
+ {
+ EventBridge b = bridge.get();
+ Route r = b.createRoute(RouteType.EGRESS, Object.class);
+ Assert.assertNotNull(r);
+ Assert.assertEquals(RouteType.EGRESS, r.getType());
+ Assert.assertEquals(Object.class, r.getPayloadType());
+ }
+
+
+}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/RouteImplTest.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge;
+
+import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Qualifier;
+
+import org.jboss.seam.jms.bridge.Route;
+import org.jboss.seam.jms.bridge.RouteImpl;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class RouteImplTest
+{
+ @Qualifier public @interface TestQualifier {}
+
+ @SuppressWarnings("serial")
+ @Test
+ public void addQualifier()
+ {
+ Route r = new RouteImpl(EGRESS, Object.class);
+ Annotation qualifier = new AnnotationLiteral<TestQualifier>() {};
+ r.addQualifiers(qualifier);
+ Assert.assertFalse(r.getQualifiers().isEmpty());
+ Assert.assertEquals(1, r.getQualifiers().size());
+ Assert.assertEquals(qualifier, r.getQualifiers().iterator().next());
+ }
+
+ @SuppressWarnings("serial")
+ @Test(expected=IllegalArgumentException.class)
+ public void addQualifier_non_qualifier()
+ {
+ Route r = new RouteImpl(EGRESS, Object.class);
+ r.addQualifiers(new AnnotationLiteral<Deprecated>() {});
+ }
+}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route)
Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.test.bridge.route;
-
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-
-import javax.inject.Qualifier;
-
- at Qualifier
- at Retention(RUNTIME)
-public @interface Bridged
-{
-}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/Bridged.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge.route;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+ at Qualifier
+ at Retention(RUNTIME)
+public @interface Bridged
+{
+}
Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.test.bridge.route;
-
-import javax.enterprise.event.Event;
-import javax.inject.Inject;
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.QueueReceiver;
-
-import org.jboss.arquillian.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.jms.annotations.JmsDestination;
-import org.jboss.seam.jms.test.Util;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
- at RunWith(Arquillian.class)
-public class RouteTest
-{
- @Deployment
- public static JavaArchive createDeployment()
- {
- return Util.createDeployment(RouteTest.class);
- }
-
- @Inject Connection c;
- @Inject @JmsDestination(jndiName="queue/DLQ") QueueReceiver qr;
- @Inject @Bridged Event<String> event;
- @Inject Event<String> plainEvent;
-
- @Test
- public void forwardSimpleEvent() throws JMSException
- {
- String expected = "test";
- c.start();
- event.fire(expected);
- Message m = qr.receive(3000);
- Assert.assertTrue(m != null);
- Assert.assertTrue(m instanceof ObjectMessage);
- Assert.assertEquals(expected, ((ObjectMessage) m).getObject());
- }
-
- @Test
- public void noMatchingRoutes() throws JMSException
- {
- String expected = "test";
- c.start();
- plainEvent.fire(expected);
- Message m = qr.receive(3000);
- Assert.assertNull(m);
- }
-}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RouteTest.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge.route;
+
+import javax.enterprise.event.Event;
+import javax.inject.Inject;
+import javax.jms.Connection;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.QueueReceiver;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.seam.jms.annotations.JmsDestination;
+import org.jboss.seam.jms.test.Util;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+ at RunWith(Arquillian.class)
+public class RouteTest
+{
+ @Deployment
+ public static JavaArchive createDeployment()
+ {
+ return Util.createDeployment(RouteTest.class);
+ }
+
+ @Inject Connection c;
+ @Inject @JmsDestination(jndiName="queue/DLQ") QueueReceiver qr;
+ @Inject @Bridged Event<String> event;
+ @Inject Event<String> plainEvent;
+
+ @Test
+ public void forwardSimpleEvent() throws JMSException
+ {
+ String expected = "test";
+ c.start();
+ event.fire(expected);
+ Message m = qr.receive(3000);
+ Assert.assertTrue(m != null);
+ Assert.assertTrue(m instanceof ObjectMessage);
+ Assert.assertEquals(expected, ((ObjectMessage) m).getObject());
+ }
+
+ @Test
+ public void noMatchingRoutes() throws JMSException
+ {
+ String expected = "test";
+ c.start();
+ plainEvent.fire(expected);
+ Message m = qr.receive(3000);
+ Assert.assertNull(m);
+ }
+}
Deleted: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java
===================================================================
--- modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java 2010-05-20 23:28:05 UTC (rev 12765)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.seam.jms.test.bridge.route;
-
-import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
-
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Inject;
-import javax.jms.Queue;
-
-import org.jboss.seam.jms.annotations.JmsDestination;
-import org.jboss.seam.jms.bridge.EventBridge;
-import org.jboss.seam.jms.bridge.EventRouting;
-import org.jboss.seam.jms.bridge.Route;
-
-public class RoutingConfig
-{
- @Inject EventBridge bridge;
-
- @Inject @JmsDestination(jndiName = "queue/DLQ") Queue q;
-
- private static final AnnotationLiteral<Bridged> BRIDGED = new AnnotationLiteral<Bridged>()
- {
- private static final long serialVersionUID = 1L;
- };
-
- @EventRouting
- public Route getRoute()
- {
- return bridge.createRoute(EGRESS, String.class).addQualifiers(BRIDGED).connectTo(Queue.class, q);
- }
-}
Copied: modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java (from rev 12765, modules/jms/branches/eventbridge/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java)
===================================================================
--- modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java (rev 0)
+++ modules/jms/trunk/impl/src/test/java/org/jboss/seam/jms/test/bridge/route/RoutingConfig.java 2010-05-20 23:58:16 UTC (rev 12766)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.jms.test.bridge.route;
+
+import static org.jboss.seam.jms.bridge.RouteType.EGRESS;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+import javax.jms.Queue;
+
+import org.jboss.seam.jms.annotations.JmsDestination;
+import org.jboss.seam.jms.bridge.EventBridge;
+import org.jboss.seam.jms.bridge.EventRouting;
+import org.jboss.seam.jms.bridge.Route;
+
+public class RoutingConfig
+{
+ @Inject EventBridge bridge;
+
+ @Inject @JmsDestination(jndiName = "queue/DLQ") Queue q;
+
+ private static final AnnotationLiteral<Bridged> BRIDGED = new AnnotationLiteral<Bridged>()
+ {
+ private static final long serialVersionUID = 1L;
+ };
+
+ @EventRouting
+ public Route getRoute()
+ {
+ return bridge.createRoute(EGRESS, String.class).addQualifiers(BRIDGED).connectTo(Queue.class, q);
+ }
+}
More information about the seam-commits
mailing list