[jboss-svn-commits] JBL Code SVN: r23020 - in labs/jbossesb/workspace/skeagh: api/service/src/main/java/org/jboss/esb/context and 20 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Sep 23 12:50:02 EDT 2008
Author: tfennelly
Date: 2008-09-23 12:50:02 -0400 (Tue, 23 Sep 2008)
New Revision: 23020
Added:
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/FaultContext.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/DeadLetterPersistanceService.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/package.html
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/preinstalled/
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/preinstalled/deadletter.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/preinstalled/
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml
Modified:
labs/jbossesb/workspace/skeagh/api/routing/src/main/java/org/jboss/esb/routing/MessageDispatcher.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java
labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/routing/ServiceInvoker.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/schedule/SimpleSchedule.java
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-deploy-01.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-inandoutrouters_01.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-inrouters_01.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-outrouters_01.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/HelloInboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-no-service.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-intransform.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-outtransform.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-service.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-01.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-02.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-03.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/jbossesb-config.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/MockScheduledInboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-01.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-02.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-03.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties
Log:
Adding some fault support
Modified: labs/jbossesb/workspace/skeagh/api/routing/src/main/java/org/jboss/esb/routing/MessageDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/routing/src/main/java/org/jboss/esb/routing/MessageDispatcher.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/api/routing/src/main/java/org/jboss/esb/routing/MessageDispatcher.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -40,7 +40,6 @@
*
* @param message The message to be dispatched.
* @param invocationContext The InvocationContext for the message dispatch.
- * @throws RoutingException An exception occured while dispatching the message.
*/
- void dispatch(Message message, InvocationContext invocationContext) throws RoutingException;
+ void dispatch(Message message, InvocationContext invocationContext);
}
Copied: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/FaultContext.java (from rev 22982, labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/FaultContext.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/FaultContext.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.context;
+
+import org.jboss.esb.message.Message;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * Fault Context.
+ * <p/>
+ * Stores fault context data. Check for the existance of a fault by calling
+ * {@link #getFault()}. This method will return any fault, or
+ * null if no fault occured.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
+ */
+public class FaultContext
+{
+ /**
+ * The fault.
+ */
+ private Throwable fault;
+ /**
+ * The fault recipient.
+ */
+ private ServiceName faultRecipient;
+ /**
+ * The fault message.
+ */
+ private Message faultMessage;
+
+ /**
+ * Get the fault.
+ *
+ * @return The fault, or null if no fault has occured.
+ */
+ public final Throwable getFault()
+ {
+ return fault;
+ }
+
+ /**
+ * Set the fault.
+ *
+ * @param fault The fault.
+ */
+ public final void setFault(final Throwable fault)
+ {
+ if(this.fault == null)
+ {
+ this.fault = fault;
+ }
+ }
+
+ /**
+ * Get the fault recipient.
+ * <p/>
+ * This is the name of the service to which the fault was routed.
+ *
+ * @return The fault recipient.
+ */
+ public final ServiceName getFaultRecipient()
+ {
+ return faultRecipient;
+ }
+
+ /**
+ * Set the fault recipient.
+ * <p/>
+ * This is the name of the service to which the fault was routed.
+ *
+ * @param faultRecipient The fault recipient.
+ */
+ public final void setFaultRecipient(final ServiceName faultRecipient)
+ {
+ this.faultRecipient = faultRecipient;
+ }
+
+ /**
+ * Get the fault message.
+ * <p/>
+ * The message at the point in time when the fault occured.
+ *
+ * @return The fault message.
+ */
+ public final Message getFaultMessage()
+ {
+ return faultMessage;
+ }
+
+ /**
+ * Set the fault message.
+ * <p/>
+ * The message at the point in time when the fault occured.
+ *
+ * @param faultMessage The fault message.
+ */
+ public final void setFaultMessage(final Message faultMessage)
+ {
+ if(this.faultMessage == null)
+ {
+ this.faultMessage = faultMessage;
+ }
+ }
+}
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/FaultContext.java
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/context/InvocationContext.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -36,6 +36,10 @@
public class InvocationContext implements ESBContext, Serializable
{
/**
+ * Context ThreadLocal.
+ */
+ private static ThreadLocal<InvocationContext> contextTL = new ThreadLocal<InvocationContext>();
+ /**
* Context Data Map.
*/
private Map<Object, Object> contextMap = new LinkedHashMap<Object, Object>();
@@ -44,9 +48,9 @@
*/
private Map<String, String> invocationParameters = new LinkedHashMap<String, String>();
/**
- * Context ThreadLocal.
+ * Fault context.
*/
- private static ThreadLocal<InvocationContext> contextTL = new ThreadLocal<InvocationContext>();
+ private FaultContext faultContext = new FaultContext();
/**
* Public default constructor.
@@ -78,7 +82,8 @@
if (context != null)
{
contextTL.set(context);
- } else
+ }
+ else
{
contextTL.remove();
}
@@ -140,4 +145,14 @@
{
return invocationParameters;
}
+
+ /**
+ * Get the fault context.
+ *
+ * @return The fault context.
+ */
+ public final FaultContext getFaultContext()
+ {
+ return faultContext;
+ }
}
Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -127,4 +127,15 @@
*/
this.attachments = attachments;
}
+
+ /**
+ * Create a shallow clone of the message.
+ * @return A Shallow clone of the message.
+ */
+ public final Object clone()
+ {
+ Message clone = new Message(payload);
+ clone.getAttachments().putAll(getAttachments());
+ return clone;
+ }
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -479,7 +479,7 @@
{
try
{
- deployObject(service.getValue().getService(), null, service.getKey());
+ deployObject(service.getValue().getService(), service.getKey().toString(), service.getKey());
logger.debug("Deployed service '" + service.getKey() + "' (" + service.getValue().getClass().getName() + ").");
}
catch (InvocationTargetException e)
@@ -521,7 +521,6 @@
dispatcher.setService(getService(aggregatedDeploymentUnit, serviceName));
dispatcher.setTransformers(routerConfig.getTransformers());
dispatcher.setOutboundRouters(aggregatedDeploymentUnit.getOutboundRouters().get(serviceName));
- dispatcher.initialize();
// Set the dispacther on both the router and the routerconfig. We set it on the config
// so we can access it later...
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/config/digest/CreateObject.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -209,12 +209,12 @@
if (annotation != null)
{
final boolean wasInConfig = setFields.contains(field);
- if (annotation.use() == Use.REQUIRED && !wasInConfig)
+ if (annotation.use() == Use.REQUIRED && !wasInConfig && annotation.defaultVal().equals(UNASSIGNED))
{
throw new SmooksException("Property '" + field.getName() + "' of class '" + instance.getClass().getName() + "' was annotated as being required. This property was not specified in the configuration.");
}
// set optional 'defaultVal' value if one was specified on the annotation
- else if (annotation.use() == Use.OPTIONAL && !wasInConfig && !annotation.defaultVal().equals(UNASSIGNED))
+ else if (!wasInConfig && !annotation.defaultVal().equals(UNASSIGNED))
{
try
{
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -19,18 +19,24 @@
*/
package org.jboss.esb.dispatch;
+import org.apache.log4j.Logger;
import org.jboss.esb.context.AddressingContext;
import org.jboss.esb.context.DeploymentContext;
+import org.jboss.esb.context.FaultContext;
+import org.jboss.esb.context.InvocationContext;
import org.jboss.esb.deploy.config.OutboundRouterConfig;
+import org.jboss.esb.failure.DeadLetterPersistanceService;
+import org.jboss.esb.federate.bus.BusMessage;
import org.jboss.esb.federate.bus.BusOutboundRouter;
import org.jboss.esb.message.Message;
import org.jboss.esb.message.MessageTransformer;
import org.jboss.esb.routing.MessageDispatcher;
import org.jboss.esb.routing.OutboundRouter;
import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.routing.ServiceInvoker;
import org.jboss.esb.service.Service;
+import org.jboss.esb.service.ServiceException;
import org.jboss.esb.service.ServiceName;
-import org.jboss.esb.service.ServiceException;
import java.util.List;
@@ -42,6 +48,10 @@
public abstract class AbstractDispatcher implements MessageDispatcher
{
/**
+ * Logger.
+ */
+ private Logger logger;
+ /**
* The associated deployment context.
*/
private DeploymentContext deploymentContext;
@@ -64,9 +74,9 @@
*/
private List<OutboundRouterConfig> outboundRouters;
/**
- * Clone outbound routing transforms.
+ * ServiceInvoker.
*/
- private boolean cloneOnOutboundTransforms = false;
+ private ServiceInvoker serviceInvoker;
/**
* Public constructor.
@@ -76,33 +86,11 @@
public AbstractDispatcher(final DeploymentContext deploymentContext)
{
this.deploymentContext = deploymentContext;
- //serviceInvoker = new ServiceInvoker(deploymentContext);
+ logger = Logger.getLogger(getClass());
+ serviceInvoker = new ServiceInvoker(deploymentContext);
}
/**
- * Initialize the dispatcher.
- */
- public final void initialize()
- {
- if (outboundRouters != null && !outboundRouters.isEmpty())
- {
- int numTransformationSets = 0;
- for (OutboundRouterConfig outboundRouterConfig : outboundRouters)
- {
- if (outboundRouterConfig.getTransformers() != null)
- {
- numTransformationSets++;
- }
- }
- // If we have multiple outbound routers performing transforms
- // on the message before routing, we need to clone the message,
- // otherwise the message will be corrupted between routing
- // operations...
- cloneOnOutboundTransforms = (numTransformationSets > 1);
- }
- }
-
- /**
* Get the associated deployment context.
*
* @return The deployment context.
@@ -142,10 +130,8 @@
*
* @param theMessage The message.
* @return The processed message. Can be a new Message instance.
- * @throws org.jboss.esb.routing.RoutingException
- * Error processing message message in the Service.
*/
- protected final Message dispatchToService(final Message theMessage) throws RoutingException
+ protected final Message dispatchToService(final Message theMessage)
{
if (service != null)
{
@@ -157,11 +143,32 @@
}
catch (ServiceException e)
{
-
+ ServiceName faultTo = AddressingContext.getContext().getFaultTo();
+
+ if (faultTo != null)
+ {
+ FaultContext faultContext = InvocationContext.getContext().getFaultContext();
+ Message faultMessage = new Message(BusMessage.create(theMessage));
+
+ faultContext.setFaultMessage(theMessage);
+ faultContext.setFault(e);
+ faultContext.setFaultRecipient(faultTo);
+
+ logger.error("ServiceException in service '" + serviceName + "'. Routing fault message to '" + faultTo + "'.", e);
+ serviceInvoker.send(faultMessage, faultTo);
+ // If the routing of the fault message to the faultTo address fails, it will be routed to the
+ // Dead Letter Service and retried later.
+ }
+ else
+ {
+ logger.error("ServiceException in service '" + serviceName + "'. 'faultTo' address not specified. Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", e);
+ routeToDeadLetterService(theMessage, e);
+ }
}
catch (Throwable t)
{
- throw new RoutingException("Error processing message.", t);
+ logger.error("Non ServiceException in service '" + serviceName + "'. Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", t);
+ routeToDeadLetterService(theMessage, t);
}
}
@@ -175,50 +182,103 @@
* @throws org.jboss.esb.routing.RoutingException
* Error routing message.
*/
- protected final void applyOutboundRouters(final Message outMessage) throws RoutingException
+ protected final void applyOutboundRouters(final Message outMessage)
{
if (outboundRouters != null && !outboundRouters.isEmpty())
{
- AddressingContext addressContext = AddressingContext.getContext();
+ FaultContext faultContext = InvocationContext.getContext().getFaultContext();
- // If this deployment doesn't specifiy this service, see is there a
- // Service by this name on one of the monitored deployments, and route
- // it there...
- if (!getServiceName().equals(addressContext.getFrom()))
+ if (faultContext.getFault() == null)
{
- for (OutboundRouterConfig outboundRouterConfig : outboundRouters)
+ AddressingContext addressContext = AddressingContext.getContext();
+
+ // If this deployment has not applied a Service to the message (i.e.
+ // the deployment doesn't host the Service), see is there a
+ // Service by this name on one of the monitored deployments, and route
+ // it there...
+ if (!addressContext.getTo().equals(addressContext.getFrom()))
{
- OutboundRouter outRouter = outboundRouterConfig.getRouter();
- if (outRouter instanceof BusOutboundRouter)
+ for (OutboundRouterConfig outboundRouterConfig : outboundRouters)
{
- if (((BusOutboundRouter) outRouter).hasService(serviceName))
+ OutboundRouter outRouter = outboundRouterConfig.getRouter();
+ if (outRouter instanceof BusOutboundRouter)
{
- outRouter.route(outMessage);
- // In this case, we don't pass the message to the other outrouters (below).
- // We leave it to the other deployment to manage sending the message
- // to outrouters after it's Service instance has processed it...
- return;
+ if (((BusOutboundRouter) outRouter).hasService(serviceName))
+ {
+ try
+ {
+ outRouter.route(outMessage);
+ }
+ catch (Throwable t)
+ {
+ logger.error("Exception routing message to Service '" + addressContext.getTo() + "' via OutboundRouter. Router Configuration '" + outboundRouterConfig.getName() + "'. Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", t);
+ routeToDeadLetterService(outMessage, t);
+ }
+ // In this case, we don't pass the message to the outrouters (below).
+ // We leave it to the other deployment to manage sending the message
+ // to the outrouters after it's Service instance has processed it...
+ return;
+ }
}
}
}
- }
- for (OutboundRouterConfig outboundRouter : outboundRouters)
- {
- OutboundRouter outRouter = outboundRouter.getRouter();
- if (outRouter instanceof BusOutboundRouter)
+ // Create a clone of the message in case there's an error or
+ // there are multiple outrouters with transformers on them...
+ Message clone = (Message) outMessage.clone();
+
+ for (OutboundRouterConfig outboundRouterConfig : outboundRouters)
{
- if (!((BusOutboundRouter) outRouter).hasService(serviceName))
+ OutboundRouter outRouter = outboundRouterConfig.getRouter();
+ if (outRouter instanceof BusOutboundRouter)
{
- outRouter.route(outMessage);
+ if (!((BusOutboundRouter) outRouter).hasService(serviceName))
+ {
+ try
+ {
+ outRouter.route(outMessage);
+ }
+ catch (Throwable t)
+ {
+ logger.error("Exception routing message to remote OutboundRouter for Service '" + addressContext.getTo() + "' via OutboundRouter. Router Configuration '" + outboundRouterConfig.getName() + "'. Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", t);
+ routeToDeadLetterService(outMessage, t);
+ }
+ }
}
+ else
+ {
+ try
+ {
+ applyOutboundTransformers(outMessage, outboundRouterConfig.getTransformers());
+ }
+ catch (Throwable t)
+ {
+ logger.error("Exception applying message transformations on OutboundRouter for Service '" + addressContext.getTo() + "' via OutboundRouter. Router Configuration '" + outboundRouterConfig.getName() + "'. Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", t);
+ // We route the clone because it's unmodified... allows us to
+ // start from scratch again...
+ routeToDeadLetterService(clone, t);
+ }
+ try
+ {
+ outRouter.route(outMessage);
+ }
+ catch (Throwable t)
+ {
+ logger.error("Exception routing message to OutboundRouter for Service '" + addressContext.getTo() + "' via OutboundRouter. Router Configuration '" + outboundRouterConfig.getName() + "'. Routing to Dead Letter Service '" + DeadLetterPersistanceService.SERVICE_NAME + "'.", t);
+ // We route the clone because it's unmodified... allows us to
+ // start from scratch again...
+ routeToDeadLetterService(clone, t);
+ }
+ finally
+ {
+ // Reset the message contents in case there are multiple
+ // outrouters...
+ outMessage.setPayload(clone.getPayload());
+ outMessage.getAttachments().clear();
+ outMessage.getAttachments().putAll(clone.getAttachments());
+ }
+ }
}
- else
- {
- // TODO: cloneOnOutboundTransforms
- applyOutboundTransformers(outMessage, outboundRouter.getTransformers());
- outRouter.route(outMessage);
- }
}
}
}
@@ -328,4 +388,37 @@
{
this.outboundRouters = outboundRouters;
}
+
+ /**
+ * Route the supplied message to the Dead Letter Service.
+ *
+ * @param theMessage The message.
+ * @param theFault The fault that triggered the routing of the message to the Dead Letter Service.
+ */
+ protected void routeToDeadLetterService(final Message theMessage, final Throwable theFault)
+ {
+ if (!routeToDeadLetterService(theMessage, theFault, serviceInvoker))
+ {
+ logger.fatal("Unable to route message to Dead Letter Service.");
+ }
+ }
+
+ /**
+ * Route the supplied message to the Dead Letter Service.
+ *
+ * @param theMessage The message.
+ * @param theFault The fault that triggered the routing of the message to the Dead Letter Service.
+ * @param serviceInvoker The ServiceInvoker instance to use for the delivery.
+ * @return True if the message was delivered to the Dead Letter Service.
+ */
+ public static boolean routeToDeadLetterService(final Message theMessage, final Throwable theFault, final ServiceInvoker serviceInvoker)
+ {
+ FaultContext faultContext = InvocationContext.getContext().getFaultContext();
+
+ faultContext.setFaultMessage(theMessage);
+ faultContext.setFault(theFault);
+ faultContext.setFaultRecipient(DeadLetterPersistanceService.SERVICE_NAME);
+
+ return serviceInvoker.send(new Message(BusMessage.create(theMessage)), DeadLetterPersistanceService.SERVICE_NAME);
+ }
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -19,11 +19,11 @@
*/
package org.jboss.esb.dispatch;
+import org.apache.log4j.Logger;
import org.jboss.esb.context.AddressingContext;
import org.jboss.esb.context.DeploymentContext;
import org.jboss.esb.context.InvocationContext;
import org.jboss.esb.message.Message;
-import org.jboss.esb.routing.RoutingException;
import org.jboss.esb.util.AssertArgument;
/**
@@ -33,6 +33,10 @@
*/
public class LocalDispatcher extends AbstractDispatcher
{
+ /**
+ * Logger.
+ */
+ private static Logger logger = Logger.getLogger(LocalDispatcher.class);
/**
* Public constructor.
@@ -54,9 +58,8 @@
*
* @param message The message to be dispatched.
* @param invocationContext The InvocationContext for the message dispatch.
- * @throws RoutingException Error dispatching message.
*/
- public final void dispatch(final Message message, final InvocationContext invocationContext) throws RoutingException
+ public final void dispatch(final Message message, final InvocationContext invocationContext)
{
AssertArgument.isNotNull(message, "message");
AssertArgument.isNotNull(invocationContext, "invocationContext");
@@ -74,11 +77,20 @@
InvocationContext.setContext(invocationContext);
try
{
- applyInboundTransforms(message);
+ try
+ {
+ applyInboundTransforms(message);
+ }
+ catch (Throwable t)
+ {
+ // The message must make it past the inbound transformers...
+ String errorMessage = "Exception applying Inbound Transforms to Service '" + getServiceName() + "'. Rejecting message. Fix transformation!";
+
+ logger.error(errorMessage, t);
+ throw new IllegalStateException(errorMessage, t);
+ }
outMessage = dispatchToService(message);
applyOutboundRouters(outMessage);
-
- // TODO; Use the faultTo address if there's an issue??
} finally
{
InvocationContext.setContext(null);
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/DeadLetterPersistanceService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/DeadLetterPersistanceService.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/DeadLetterPersistanceService.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.failure;
+
+import org.jboss.esb.message.Message;
+import org.jboss.esb.service.Service;
+import org.jboss.esb.service.ServiceException;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DeadLetterPersistanceService implements Service
+{
+
+ /**
+ * Service name.
+ */
+ public static final ServiceName SERVICE_NAME = new ServiceName("JBossESB", DeadLetterPersistanceService.class.getSimpleName());
+
+ /**
+ * Persist the Dead Letter message.
+ * @param message The message.
+ * @return The original message.
+ * @throws ServiceException An exception occured while persisting the message.
+ */
+ public final Message process(final Message message) throws ServiceException
+ {
+ return message;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/DeadLetterPersistanceService.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.failure;
+
+import org.jboss.esb.message.Message;
+import org.jboss.esb.schedule.AbstractScheduleListener;
+import org.jboss.esb.schedule.SchedulingException;
+import org.jboss.esb.service.Service;
+import org.jboss.esb.service.ServiceException;
+
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+/**
+ * Mock Dead Letter Service.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class MockDeadLetterService extends AbstractScheduleListener implements Service
+{
+
+ /**
+ * Flag to indicate whether or not the Service is expecting delivery of dead messages.
+ */
+ private boolean expectingMessages = false;
+ /**
+ * Messages.
+ */
+ private Queue<Message> messages = new ConcurrentLinkedQueue<Message>();
+
+ /**
+ * Service process method.
+ *
+ * @param message The message to be processed.
+ * @return The resultant {@link Message}.
+ * @throws ServiceException Service exception processing the message.
+ */
+ public final Message process(final Message message) throws ServiceException
+ {
+ if(expectingMessages)
+ {
+ throw new RuntimeException("No expecting Dead Letter message deliveries. Call setExpectingMessages(true) to turn off this error.");
+ }
+ messages.add(message);
+ return message;
+ }
+
+ /**
+ * On schedule event processor.
+ *
+ * @throws SchedulingException Exception processing schedule event.
+ */
+ public final void onSchedule() throws SchedulingException
+ {
+ // Redliver the messages in the queue...
+ }
+
+ /**
+ * Get the messages sent to the service.
+ *
+ * @return The messages.
+ */
+ public final Queue<Message> getMessages()
+ {
+ return messages;
+ }
+
+ /**
+ * Turn on off the flag indicating that this MockDeadLetter Service
+ * is expecting message deliveries.
+ * @param expectingMessages True if the Service should expect messages, otherwise false.
+ */
+ public final void setExpectingMessages(final boolean expectingMessages)
+ {
+ this.expectingMessages = expectingMessages;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/package.html (from rev 22980, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/package.html)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/package.html 2008-09-23 16:50:02 UTC (rev 23020)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+ESB Failure Handling.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -434,7 +434,7 @@
else
{
// New deployment. Add a monitor...
- monitor = new DeploymentMonitor(deployNotification.getServiceSet(), bus);
+ monitor = new DeploymentMonitor(deployNotification.getServiceSet(), bus, runtime.getContext());
attachDeploymentMonitor(monitor);
deploymentMonitors.put(deploymentId, monitor);
detailsNotification.getMonitoredDeployments().add(deploymentId);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -19,7 +19,14 @@
*/
package org.jboss.esb.federate;
+import org.jboss.esb.context.DeploymentContext;
+import org.jboss.esb.context.FaultContext;
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.failure.DeadLetterPersistanceService;
import org.jboss.esb.federate.bus.Bus;
+import org.jboss.esb.federate.bus.BusMessage;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.routing.ServiceInvoker;
import org.jboss.esb.service.ServiceName;
import org.jboss.esb.util.AssertArgument;
@@ -52,20 +59,27 @@
* Deployment online/offline flag.
*/
private boolean online;
+ /**
+ * Service Invoker.
+ */
+ private ServiceInvoker serviceInvoker;
/**
* Constructor.
*
- * @param serviceSets Deployment Service sets.
- * @param bus The bus to the services on the associated deployment.
+ * @param serviceSets Deployment Service sets.
+ * @param bus The bus to the services on the associated deployment.
+ * @param deploymentContext The deployment context of the monitor owner.
*/
- public DeploymentMonitor(final DeploymentServiceSets serviceSets, final Bus bus)
+ public DeploymentMonitor(final DeploymentServiceSets serviceSets, final Bus bus, final DeploymentContext deploymentContext)
{
AssertArgument.isNotNull(serviceSets, "serviceSets");
this.lastHeartbeat = System.currentTimeMillis();
this.serviceSets = serviceSets;
this.bus = bus;
this.online = true;
+
+ serviceInvoker = new ServiceInvoker(deploymentContext);
}
/**
@@ -120,6 +134,7 @@
/**
* Does the target deployment have the specified service.
+ *
* @param serviceName The Service name.
* @return True if the target deployment has a Service instance with the specified name, otherwise false.
*/
@@ -131,9 +146,10 @@
/**
* Does the target deployment have any {@link org.jboss.esb.routing.OutboundRouter}
* instances for the specified service.
+ *
* @param serviceName The Service name.
* @return True if the target deployment has any {@link org.jboss.esb.routing.OutboundRouter}
- * instances for the specified service, otherwise false.
+ * instances for the specified service, otherwise false.
*/
public final boolean hasServiceRouter(final ServiceName serviceName)
{
@@ -154,6 +170,41 @@
}
/**
+ * Send the supplied message to the specified deployment via the bus.
+ *
+ * @param message The message.
+ * @param targetDeploymentId The target deployment ID.
+ * @param routeToDeadLetterOnFailure Route the message to the Dead Letter Service on failure
+ * to deliver the message onto the bus.
+ * @return True if the message was sent onto the target bus, otherwise false.
+ */
+ public final boolean send(final BusMessage message, final String targetDeploymentId, final boolean routeToDeadLetterOnFailure)
+ {
+ try
+ {
+ bus.send(message, targetDeploymentId);
+ return true;
+ }
+ catch (Throwable t)
+ {
+ if(routeToDeadLetterOnFailure)
+ {
+ FaultContext faultContext = InvocationContext.getContext().getFaultContext();
+
+ faultContext.setFaultMessage(message.getMessage());
+ faultContext.setFault(t);
+ faultContext.setFaultRecipient(DeadLetterPersistanceService.SERVICE_NAME);
+
+ return serviceInvoker.send(new Message(message), DeadLetterPersistanceService.SERVICE_NAME);
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+
+ /**
* Monitor toString.
*
* @return String representation of the monitor.
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -24,7 +24,6 @@
import org.jboss.esb.context.InvocationContext;
import org.jboss.esb.dispatch.AbstractDispatcher;
import org.jboss.esb.message.Message;
-import org.jboss.esb.routing.RoutingException;
import org.jboss.esb.service.ServiceName;
import org.jboss.esb.util.AssertArgument;
@@ -54,9 +53,8 @@
*
* @param message The message to be dispatched.
* @param invocationContext The InvocationContext for the message dispatch.
- * @throws RoutingException An exception occured while dispatching the message.
*/
- public final void dispatch(final Message message, final InvocationContext invocationContext) throws RoutingException
+ public final void dispatch(final Message message, final InvocationContext invocationContext)
{
AssertArgument.isNotNull(message, "message");
AssertArgument.isNotNull(invocationContext, "invocationContext");
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -83,9 +83,8 @@
* Dispatch the supplied message to the target service
* @param esbMessage The ESB Message.
* @param invocationContext The Invocation Context to be used.
- * @throws RoutingException An exception occured while dispatching the message.
*/
- public final void dispatch(final Message esbMessage, final InvocationContext invocationContext) throws RoutingException
+ public final void dispatch(final Message esbMessage, final InvocationContext invocationContext)
{
dispatcher.dispatch(esbMessage, invocationContext);
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -20,6 +20,7 @@
package org.jboss.esb.federate.bus;
import org.jboss.esb.context.AddressingContext;
+import org.jboss.esb.context.InvocationContext;
import org.jboss.esb.message.Message;
import java.io.Serializable;
@@ -114,4 +115,20 @@
{
this.message = message;
}
+
+ /**
+ * Create a {@link BusMessage} instance from the supplied message and the existing thread context.
+ * @param theMessage Th message.
+ * @return The bundled {@link BusMessage} instance.
+ */
+ public static BusMessage create(final Message theMessage)
+ {
+ BusMessage busMessage = new BusMessage();
+
+ busMessage.setAddressingContext(AddressingContext.getContext());
+ busMessage.setInvocationParameters(InvocationContext.getContext().getInvocationParameters());
+ busMessage.setMessage(theMessage);
+
+ return busMessage;
+ }
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import java.util.Iterator;
/**
* Outbound router for a Bus.
@@ -157,17 +158,23 @@
*/
private boolean routeToService(final BusMessage busMessage) throws RoutingException
{
- for (DeploymentMonitor deploymentMonitor : deploymentMonitors)
+ Iterator<DeploymentMonitor> monitorIterator = deploymentMonitors.iterator();
+
+ while(monitorIterator.hasNext())
{
+ DeploymentMonitor deploymentMonitor = monitorIterator.next();
+
if (deploymentMonitor.isOnline())
{
Set<ServiceName> services = deploymentMonitor.getServiceSets().getServices();
if (services.contains(serviceName))
{
- deploymentMonitor.getBus().send(busMessage, deploymentMonitor.getServiceSets().getDeploymentId());
- // we're done...
- return true;
+ if(deploymentMonitor.send(busMessage, deploymentMonitor.getServiceSets().getDeploymentId(), !monitorIterator.hasNext()))
+ {
+ // we're done...
+ return true;
+ }
}
}
}
@@ -186,8 +193,12 @@
*/
private boolean routeToOutRouters(final BusMessage busMessage) throws RoutingException
{
- for (DeploymentMonitor deploymentMonitor : deploymentMonitors)
+ Iterator<DeploymentMonitor> monitorIterator = deploymentMonitors.iterator();
+
+ while(monitorIterator.hasNext())
{
+ DeploymentMonitor deploymentMonitor = monitorIterator.next();
+
if (deploymentMonitor.isOnline())
{
Set<ServiceName> services = deploymentMonitor.getServiceSets().getServices();
@@ -195,8 +206,11 @@
if (!services.contains(serviceName) && outRoutedServices.contains(serviceName))
{
- deploymentMonitor.getBus().send(busMessage, deploymentMonitor.getServiceSets().getDeploymentId());
- return true;
+ if(deploymentMonitor.send(busMessage, deploymentMonitor.getServiceSets().getDeploymentId(), !monitorIterator.hasNext()))
+ {
+ // we're done...
+ return true;
+ }
}
}
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/routing/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/routing/ServiceInvoker.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/routing/ServiceInvoker.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -19,6 +19,7 @@
*/
package org.jboss.esb.routing;
+import org.apache.log4j.Logger;
import org.jboss.esb.context.AddressingContext;
import org.jboss.esb.context.DeploymentContext;
import org.jboss.esb.context.InvocationContext;
@@ -30,12 +31,12 @@
import org.jboss.esb.federate.bus.BusMessage;
import org.jboss.esb.federate.bus.BusRoutingContext;
import org.jboss.esb.message.Message;
-import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.service.ServiceName;
import org.jboss.esb.util.AssertArgument;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
/**
* Service Invoker.
@@ -48,6 +49,10 @@
public class ServiceInvoker
{
/**
+ * Logger.
+ */
+ private static Logger logger = Logger.getLogger(ServiceInvoker.class);
+ /**
* Deployment context.
*/
private DeploymentContext deploymentContext;
@@ -71,37 +76,55 @@
* Send the supplied message to the specified Service.
*
* @param message The message to be sent.
- * @param addressingContext
- * @throws org.jboss.esb.routing.RoutingException
+ * @param to Target Service.
+ * @throws RoutingException Error routing to service.
*/
- public void send(Message message, AddressingContext addressingContext) throws RoutingException
+ public boolean send(Message message, ServiceName to)
{
- if(addressingContext.getTo() == null)
+ AddressingContext addressing = new AddressingContext();
+
+ addressing.setTo(to);
+
+ return send(message, addressing);
+ }
+
+ /**
+ * Send the supplied message to the specified Service.
+ *
+ * @param message The message to be sent.
+ * @param addressing Addressing data.
+ * @throws RoutingException Error routing to service.
+ */
+ public boolean send(Message message, AddressingContext addressing)
+ {
+ if(addressing.getTo() == null)
{
- throw new RoutingException("Invalid AddressingContext configuration. The 'to' service name must be specified.");
+ logger.error("Invalid AddressingContext configuration. The 'to' service name must be specified.");
+ return false;
}
// The "to" service name should not be this service...
- if(addressingContext.getTo().equals(addressingContext.getFrom()))
+ if(addressing.getTo().equals(addressing.getFrom()))
{
- throw new RoutingException("Invalid AddressingContext configuration. The 'to' and 'from' service names (" + addressingContext.getTo() + ") cannot be the same.");
+ logger.error("Invalid AddressingContext configuration. The 'to' and 'from' service names (" + addressing.getTo() + ") cannot be the same.");
+ return false;
}
// Work out whether or not the target service is local,
// or on another deployment...
boolean isLocalService = false;
- if(DeploymentUtil.getService(addressingContext.getTo(), deploymentRuntime) != null)
+ if(DeploymentUtil.getService(addressing.getTo(), deploymentRuntime) != null)
{
isLocalService = true;
}
if(isLocalService)
{
- routeLocal(message, addressingContext);
+ return routeLocal(message, addressing);
}
else
{
- routeByBus(message, addressingContext);
+ return routeByBus(message, addressing);
}
}
@@ -109,25 +132,27 @@
/**
* Route the message to a local Service.
* @param message The message.
- * @param invokeAddressingContext The {@link AddressingContext} for the invocation.
+ * @param dispatchAddressingContext The {@link org.jboss.esb.context.AddressingContext} for the dispatch.
* @throws RoutingException Exception during invocation.
*/
- private void routeLocal(final Message message, final AddressingContext invokeAddressingContext) throws RoutingException
+ private boolean routeLocal(final Message message, final AddressingContext dispatchAddressingContext)
{
InvocationContext thisInvocationContext = InvocationContext.getContext();
AddressingContext thisAddressingContext = AddressingContext.getContext();
// Set the Addressing context for the new Service Invocation...
- AddressingContext.setContext(invokeAddressingContext);
+ AddressingContext.setContext(dispatchAddressingContext);
try
{
try
{
BusRoutingContext routingContext = BusRoutingContext.getContext(deploymentContext);
- BusInboundRouter inRouter = routingContext.getBusInRouters().get(invokeAddressingContext.getTo());
+ BusInboundRouter inRouter = routingContext.getBusInRouters().get(dispatchAddressingContext.getTo());
+ InvocationContext dispatchInvocationContext = new InvocationContext();
- // Going to use the same InvocationContext...
- inRouter.dispatch(message, thisInvocationContext);
+ inRouter.dispatch(message, dispatchInvocationContext);
+
+ return dispatchInvocationContext.getFaultContext().getFault() == null;
}
finally
{
@@ -149,37 +174,36 @@
* @param invokeAddressingContext The {@link AddressingContext} for the invocation.
* @throws RoutingException Exception during invocation.
*/
- private void routeByBus(final Message message, final AddressingContext invokeAddressingContext) throws RoutingException
+ private boolean routeByBus(final Message message, final AddressingContext invokeAddressingContext)
{
InvocationContext thisInvocationContext = InvocationContext.getContext();
List<DeploymentCoordinator.BusDeployment> busDeployments = deploymentRuntime.getDeploymentCoordinator().getBusDeployments();
+ BusMessage busMessage = new BusMessage();
+ busMessage.setMessage(message);
+ busMessage.setInvocationParameters(thisInvocationContext.getInvocationParameters());
+ busMessage.setAddressingContext(invokeAddressingContext);
+
// Iterate over all the Bus deployments looking for a deployment that
// is online and is hosting the target service...
for (DeploymentCoordinator.BusDeployment busDeployment : busDeployments)
{
- Set<Map.Entry<String, DeploymentMonitor>> monitors = busDeployment.getDeploymentMonitors().entrySet();
- for (Map.Entry<String, DeploymentMonitor> entry : monitors)
+ Iterator<Map.Entry<String,DeploymentMonitor>> monitors = busDeployment.getDeploymentMonitors().entrySet().iterator();
+
+ while(monitors.hasNext())
{
+ Map.Entry<String, DeploymentMonitor> entry = monitors.next();
String deploymentId = entry.getKey();
DeploymentMonitor monitor = entry.getValue();
// Is the deployment online and does it host the target service...
if(monitor.isOnline() && monitor.hasService(invokeAddressingContext.getTo()))
{
- BusMessage busMessage = new BusMessage();
-
- busMessage.setMessage(message);
- busMessage.setInvocationParameters(thisInvocationContext.getInvocationParameters());
- busMessage.setAddressingContext(invokeAddressingContext);
-
- monitor.getBus().send(busMessage, deploymentId);
-
- return;
+ return monitor.send(busMessage, deploymentId, !monitors.hasNext());
}
}
}
- throw new RoutingException("Failed to route message from service '" + invokeAddressingContext.getFrom() + "' to service '" + invokeAddressingContext.getTo() + "'. Target service is not available.");
+ return false;
}
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/schedule/SimpleSchedule.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/schedule/SimpleSchedule.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/schedule/SimpleSchedule.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -47,7 +47,7 @@
/**
* Number of times to execute (default - execute indefinitely).
*/
- @Property
+ @Property(defaultVal = "-1")
private int execCount = -1;
/**
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-23 16:50:02 UTC (rev 23020)
@@ -16,4 +16,4 @@
bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
# Pre-installed deployment units...
-# unit.deadletter=deadletter.xml
\ No newline at end of file
+unit.deadletter=deadletter.xml
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/preinstalled/deadletter.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/preinstalled/deadletter.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/preinstalled/deadletter.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -0,0 +1,7 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+ <services>
+ <service serviceCategory="JBossESB" serviceName="DeadLetterPersistanceService" serviceDescription="Default Dead Letter Service" class="org.jboss.esb.failure.DeadLetterPersistanceService" />
+ </services>
+
+</jbossesb>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/preinstalled/deadletter.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-deploy-01.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-deploy-01.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-deploy-01.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<resources>
<resource id="resource1" class="org.jboss.esb.deploy.config.MyResource" />
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-inandoutrouters_01.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-inandoutrouters_01.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-inandoutrouters_01.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<routing>
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-inrouters_01.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-inrouters_01.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-inrouters_01.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<routing>
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-outrouters_01.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-outrouters_01.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-outrouters_01.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<routing>
<outRouters serviceCategory="service-cat" serviceName="service-a">
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/HelloInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/HelloInboundRouter.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/HelloInboundRouter.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -23,7 +23,6 @@
import org.jboss.esb.message.Message;
import org.jboss.esb.routing.InboundRouter;
import org.jboss.esb.routing.MessageDispatcher;
-import org.jboss.esb.routing.RoutingException;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -37,7 +36,7 @@
this.dispatcher = dispatcher;
}
- public void sendHello(String message) throws RoutingException
+ public void sendHello(String message)
{
Message esbMessage = new Message();
esbMessage.setPayload(message);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-no-service.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-no-service.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-no-service.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<routing>
<inRouters serviceCategory="hello" serviceName="hello">
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-intransform.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-intransform.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-intransform.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<services>
<service serviceCategory="hello" serviceName="hello" serviceDescription="A Service" class="org.jboss.esb.dispatch.HelloWorldService" />
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-outtransform.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-outtransform.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-outtransform.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<services>
<service serviceCategory="hello" serviceName="hello" serviceDescription="A Service" class="org.jboss.esb.dispatch.HelloWorldService" />
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-service.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-service.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-service.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<services>
<service serviceCategory="hello" serviceName="hello" serviceDescription="A Service" class="org.jboss.esb.dispatch.HelloWorldService" />
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -54,12 +54,12 @@
// So deployment1 should be monitoring deployment2...
monitor = (DeploymentMonitor) coordinator1.getBusDeployments().get(0).getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment2:x[Services: [hello:goodbye]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
+ assertEquals("{online=true} deployment2:x[Services: [hello:goodbye, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
// And deployment2 should be monitoring deployment1...
monitor = (DeploymentMonitor) coordinator2.getBusDeployments().get(0).getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
// Now lets deploy another services
DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-03.xml"));
@@ -102,12 +102,12 @@
// So deployment1 should be monitoring deployment2...
monitor = (DeploymentMonitor) coordinator1.getBusDeployments().get(0).getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment2:x[Services: [hello:goodbye]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
+ assertEquals("{online=true} deployment2:x[Services: [hello:goodbye, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
// And deployment2 should be monitoring deployment1...
monitor = (DeploymentMonitor) coordinator2.getBusDeployments().get(0).getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
} finally {
deployment2.undeploy();
}
@@ -147,12 +147,12 @@
// So deployment1 should be monitoring deployment2...
monitor = (DeploymentMonitor) coordinator1.getBusDeployments().get(0).getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment2:x[Services: [hello:goodbye]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
+ assertEquals("{online=true} deployment2:x[Services: [hello:goodbye, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
// And deployment2 should be monitoring deployment1...
monitor = (DeploymentMonitor) coordinator2.getBusDeployments().get(0).getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
// Now lets switch off the heartbeat broadcast on deployment1...
coordinator1.setBroadcastHeartbeat(false);
@@ -161,7 +161,7 @@
// deployment2 should see deployment1 as being offline now...
monitor = (DeploymentMonitor) coordinator2.getBusDeployments().get(0).getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=false} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ assertEquals("{online=false} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
// Switch the heartbeat broadcast on deployment1 back on again...
coordinator1.setBroadcastHeartbeat(true);
@@ -170,7 +170,7 @@
// deployment2 should see deployment1 as being online again...
monitor = (DeploymentMonitor) coordinator2.getBusDeployments().get(0).getDeploymentMonitors().values().toArray()[0];
monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
} finally {
deployment2.undeploy();
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-01.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-01.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-01.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<services>
<service serviceCategory="hello" serviceName="hello" serviceDescription="A Service" class="org.jboss.esb.dispatch.HelloWorldService" />
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-02.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-02.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-02.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<services>
<service serviceCategory="hello" serviceName="goodbye" serviceDescription="A Service" class="org.jboss.esb.dispatch.HelloWorldService" />
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-03.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-03.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-03.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<routing>
<inRouters serviceCategory="hello" serviceName="goodbye">
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/jbossesb-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/jbossesb-config.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/jbossesb-config.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<services>
<service serviceCategory="a" serviceName="a" serviceDescription="a" class="org.jboss.esb.deploy.config.MyTestService" />
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -34,7 +34,7 @@
this.dispatcher = dispatcher;
}
- public void sendMessage(String message) throws RoutingException
+ public void sendMessage(String message)
{
Message esbMessage = new Message();
esbMessage.setPayload(message);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/MockScheduledInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/MockScheduledInboundRouter.java 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/MockScheduledInboundRouter.java 2008-09-23 16:50:02 UTC (rev 23020)
@@ -19,13 +19,12 @@
*/
package org.jboss.esb.schedule;
+import org.jboss.esb.annotations.Initialize;
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.deploy.AssertDeployment;
import org.jboss.esb.message.Message;
import org.jboss.esb.routing.InboundRouter;
import org.jboss.esb.routing.MessageDispatcher;
-import org.jboss.esb.routing.RoutingException;
-import org.jboss.esb.annotations.Initialize;
-import org.jboss.esb.deploy.AssertDeployment;
-import org.jboss.esb.context.InvocationContext;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -42,13 +41,7 @@
public void onSchedule() throws SchedulingException
{
- try
- {
- dispatcher.dispatch(inMessage, new InvocationContext());
- } catch (RoutingException e)
- {
- throw new SchedulingException("Unable to route message.", e);
- }
+ dispatcher.dispatch(inMessage, new InvocationContext());
}
@Initialize
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-01.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-01.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-01.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<resources>
<resource id="schedule1" class="org.jboss.esb.schedule.SimpleSchedule">
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-02.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-02.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-02.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<!--
Invalid config... no "schedule1" for scheduled router.
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-03.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-03.xml 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/schedule/schedule-listener-03.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -1,4 +1,4 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
<!--
Invalid config - schedule1 does not impement org.jboss.esb.schedule.Schedule
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-23 16:39:33 UTC (rev 23019)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-23 16:50:02 UTC (rev 23020)
@@ -6,4 +6,7 @@
coordinator.heartbeat.frequency=700
# Buses to be deployed...
-bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
\ No newline at end of file
+bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
+
+# Pre-installed deployment units...
+unit.deadletter=deadletter.xml
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml 2008-09-23 16:50:02 UTC (rev 23020)
@@ -0,0 +1,15 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+ <resources>
+ <resource id="redeliverSchedule" class="org.jboss.esb.schedule.SimpleSchedule">
+ <property name="frequency">1000</property>
+ </resource>
+ </resources>
+
+ <services>
+ <service serviceCategory="JBossESB" serviceName="DeadLetterPersistanceService" serviceDescription="Mock Dead Letter Service" class="org.jboss.esb.failure.MockDeadLetterService">
+ <property name="scheduleResourceId">redeliverSchedule</property>
+ </service>
+ </services>
+
+</jbossesb>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
More information about the jboss-svn-commits
mailing list