[jboss-svn-commits] JBL Code SVN: r24208 - in labs/jbossesb/workspace/skeagh: container/osgi/jmsbus and 21 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Dec 2 09:09:58 EST 2008
Author: tfennelly
Date: 2008-12-02 09:09:58 -0500 (Tue, 02 Dec 2008)
New Revision: 24208
Added:
labs/jbossesb/workspace/skeagh/examples/util/jms-provider/log4j.xml
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusUtil.java
Modified:
labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/BusMessage.java
labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/pom.xml
labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java
labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml
labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentRegistry.java
labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml
labs/jbossesb/workspace/skeagh/examples/util/jms-provider/pom.xml
labs/jbossesb/workspace/skeagh/performance/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml
labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java
labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/bus/JMSBus_Standalone_Test.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/dispatch/AbstractDispatcher.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/InVMDeadLetterService.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/BusMediator.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/BusInboundRouter.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/invoke/ServiceInvoker.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/preinstalled/deadletter.xml
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml
Log:
https://jira.jboss.org/jira/browse/JBESB-2182
Modified: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/BusMessage.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/BusMessage.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/BusMessage.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -20,7 +20,6 @@
package org.jboss.esb.api.bus;
import org.jboss.esb.api.context.AddressingContext;
-import org.jboss.esb.api.context.InvocationContext;
import org.jboss.esb.api.history.ProcessingEventLog;
import org.jboss.esb.api.message.Message;
@@ -55,7 +54,7 @@
/**
* Message.
*/
- private Message message;
+ private byte[] message;
/**
* The processing event log.
* <p/>
@@ -115,7 +114,7 @@
*
* @return The message.
*/
- public Message getMessage()
+ public byte[] getMessage()
{
return message;
}
@@ -123,11 +122,11 @@
/**
* Set the message.
*
- * @param message The message.
+ * @param serializedMessage Serialized {@link Message}.
*/
- public void setMessage(final Message message)
+ public void setMessage(final byte[] serializedMessage)
{
- this.message = message;
+ this.message = serializedMessage;
}
/**
@@ -173,22 +172,4 @@
{
this.processingEventLog = processingEventLog;
}
-
- /**
- * Create a {@link BusMessage} instance from the supplied message and the existing thread context.
- *
- * @param theMessage Th message.
- * @param addressingContext The {@link AddressingContext} for delivery.
- * @return The bundled {@link BusMessage} instance.
- */
- public static BusMessage create(final Message theMessage, final AddressingContext addressingContext)
- {
- BusMessage busMessage = new BusMessage();
-
- busMessage.setAddressingContext(addressingContext);
- busMessage.setInvocationParameters(InvocationContext.getContext().getInvocationParameters());
- busMessage.setMessage(theMessage);
-
- return busMessage;
- }
}
Modified: labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/pom.xml 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/pom.xml 2008-12-02 14:09:58 UTC (rev 24208)
@@ -40,7 +40,7 @@
<configuration>
<instructions>
<Private-Package>org.jboss.esb.osgi.jmsbus</Private-Package>
- <Import-Package>org.jboss.esb.osgi.bus,org.jboss.esb.jms,org.jboss.esb.api.*,org.osgi.service.cm, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
+ <Import-Package>org.jboss.esb.osgi.bus,org.jboss.esb.federate.notify,org.jboss.esb.jms,org.jboss.esb.api.*,org.osgi.service.cm, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
<Bundle-Activator>org.jboss.esb.osgi.jmsbus.JmsBusProviderActivator</Bundle-Activator>
<Embed-Dependency>jbossesb-commons, commons-logging, log4j</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
Modified: labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/src/main/java/org/jboss/esb/osgi/jmsbus/JmsBusProviderActivator.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -65,6 +65,10 @@
*/
private BundleContext bundleContext;
/**
+ * Bus configuration.
+ */
+ private Dictionary busConfig;
+ /**
* JMS Bus Managed Service registration.
*/
private ServiceRegistration jmsBusManagedService;
@@ -83,6 +87,7 @@
jmsBusManagedService = bundleContext.registerService(ManagedService.class.getName(), this, props);
this.bundleContext = bundleContext;
+ configureBusProvider();
}
/**
@@ -90,11 +95,20 @@
* @param dictionary Configuration.
* @throws ConfigurationException Error configuring.
*/
- public void updated(Dictionary dictionary) throws ConfigurationException
+ public void updated(final Dictionary dictionary) throws ConfigurationException
{
- if(dictionary != null)
+ busConfig = dictionary;
+ configureBusProvider();
+ }
+
+ /**
+ * Configure and register the BusProvider Service.
+ */
+ private void configureBusProvider()
+ {
+ if(busConfig != null && bundleContext != null)
{
- Properties config = OsgiConfigUtil.toProperties(dictionary);
+ Properties config = OsgiConfigUtil.toProperties(busConfig);
String jmsProviderName = config.getProperty(PROVIDER_NAME);
String jmsProviderVersion = config.getProperty(PROVIDER_VERSION, "");
Bundle providerBundle = BundleUtil.findBundle(jmsProviderName, jmsProviderVersion, bundleContext.getBundles());
Modified: labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/pom.xml 2008-12-02 14:09:58 UTC (rev 24208)
@@ -23,7 +23,9 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Export-Package>org.jboss.esb.schedule,org.jboss.esb.invoke,org.jboss.esb.test,org.jboss.esb.osgi*</Export-Package>
+ <Export-Package>org.jboss.esb.schedule,org.jboss.esb.invoke,org.jboss.esb.test,
+ org.jboss.esb.federate.notify, org.jboss.esb.serialization*,
+ org.jboss.esb.history.events, org.jboss.esb.osgi*</Export-Package>
<Private-Package>org.jboss.esb.osgi.deploy</Private-Package>
<Import-Package>org.jboss.esb.api*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
<Bundle-Activator>org.jboss.esb.osgi.deploy.DeploymentActivator</Bundle-Activator>
Modified: labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentRegistry.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentRegistry.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/container/osgi/runtime/src/main/java/org/jboss/esb/osgi/deploy/DeploymentRegistry.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -321,7 +321,7 @@
{
if(!added)
{
- logger.error("Failed to connect JBossESB deployment '" + deploymentRuntime.getDeploymentName() + "' to Bus '" + bus.getClass().getName() + "'.");
+ logger.error("Failed to connect JBossESB deployment '" + deploymentRuntime.getDeploymentId() + "' to Bus '" + bus.getClass().getName() + "'.");
if(busMediator != null)
{
busMediator.disconnectBus();
@@ -329,7 +329,7 @@
}
else
{
- logger.debug("Successfully connected JBossESB deployment '" + deploymentRuntime.getDeploymentName() + "' to Bus '" + bus.getClass().getName() + "'.");
+ logger.debug("Successfully connected JBossESB deployment '" + deploymentRuntime.getDeploymentId() + "' to Bus '" + bus.getClass().getName() + "'.");
}
}
}
Modified: labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/examples/jms-bus/esb2/pom.xml 2008-12-02 14:09:58 UTC (rev 24208)
@@ -15,7 +15,7 @@
<properties>
<felix.log.level>1</felix.log.level><!-- 4=debug -->
- <org.jboss.esb.properties.dir>../</org.jboss.esb.properties.dir>
+ <org.jboss.esb.properties.dir>../../</org.jboss.esb.properties.dir>
</properties>
<dependencies>
@@ -32,8 +32,8 @@
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
@@ -54,10 +54,11 @@
<version>${jboss.esb.version}</version>
</dependency>
<dependency>
- <groupId>jboss.jbossesb</groupId>
- <artifactId>jbossesb-routing-file</artifactId>
- <version>${jboss.esb.version}</version>
- </dependency>
+ <!-- Required by the JMS Bus -->
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-routing-jms</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
<dependency>
<groupId>jboss.jbossesb</groupId>
<artifactId>jbossesb-osgi-jmsbus</artifactId>
@@ -79,18 +80,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <configuration>
- <executable>java</executable>
- <mainClass>org.jboss.esb.examples.jmsrouter.JmsClient</mainClass>
- <arguments>
- <argument>jbossesb.TestQueue</argument>
- <!--argument>Message payload text...</argument-->
- </arguments>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
<version>1.3</version>
@@ -108,7 +97,7 @@
<Embed-Dependency>log4j, commons-logging</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<JBossESB-ConfigFile>/jboss-esb.xml</JBossESB-ConfigFile>
- <JBossESB-DeploymentName>JMS-Bus-Example-OSGi</JBossESB-DeploymentName>
+ <JBossESB-DeploymentName>JMS-Bus-Example-OSGi-ESB2</JBossESB-DeploymentName>
</instructions>
</configuration>
</plugin>
Added: labs/jbossesb/workspace/skeagh/examples/util/jms-provider/log4j.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/util/jms-provider/log4j.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/examples/util/jms-provider/log4j.xml 2008-12-02 14:09:58 UTC (rev 24208)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+
+ <category name="org.apache.activemq">
+ <priority value="DEBUG"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
+
Property changes on: labs/jbossesb/workspace/skeagh/examples/util/jms-provider/log4j.xml
___________________________________________________________________
Name: svn:mime-type
+ text/xml
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/examples/util/jms-provider/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/util/jms-provider/pom.xml 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/examples/util/jms-provider/pom.xml 2008-12-02 14:09:58 UTC (rev 24208)
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<name>JBoss ESB - Examples JMS Provider (ActiveMQ)</name>
<groupId>jboss.jbossesb</groupId>
@@ -7,69 +8,39 @@
<version>${jboss.esb.version}</version>
<url>http://www.jboss.org/jbossesb/</url>
- <dependencies>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core</artifactId>
- <version>4.1.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.1.1.0</version>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- <version>3.0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
- <version>1.0-M1</version>
- </dependency>
- <dependency>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j-tools</artifactId>
- <version>3.0.1</version>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- </dependencies>
-
<build>
<plugins>
<plugin>
<groupId>org.apache.activemq.tooling</groupId>
<artifactId>maven-activemq-plugin</artifactId>
- <version>4.1.2</version>
+ <version>5.2.0</version>
<configuration>
- <configFile>./activemq.xml</configFile>
+ <configUri>xbean:file:./activemq.xml</configUri>
<fork>false</fork>
+ <systemProperties>
+ <property>
+ <name>log4j.configuration</name>
+ <value>./log4j.xml</value>
+ </property>
+ </systemProperties>
</configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ <version>2.5.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-xbean</artifactId>
+ <version>6.1.11</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-activemq</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ </dependencies>
</plugin>
</plugins>
</build>
Modified: labs/jbossesb/workspace/skeagh/performance/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/performance/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/performance/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml 2008-12-02 14:09:58 UTC (rev 24208)
@@ -9,6 +9,7 @@
<services>
<service serviceCategory="JBossESB" serviceName="DeadLetterService" serviceDescription="InVM Dead Letter Service" class="org.jboss.esb.failure.InVMDeadLetterService">
<property name="scheduleResourceId">redeliverSchedule</property>
+ <property name="expectingMessages">false</property>
</service>
</services>
Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -26,9 +26,13 @@
import org.jboss.esb.api.context.ResourceLocator;
import org.jboss.esb.api.exception.DeploymentException;
import org.jboss.esb.api.routing.RoutingException;
+import org.jboss.esb.serialization.java.JavaSerializer;
+import org.jboss.esb.serialization.SerializationException;
import javax.jms.JMSException;
import javax.jms.ObjectMessage;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
import java.util.Properties;
/**
@@ -88,6 +92,10 @@
* JMS Bus Message Sender.
*/
private MessageSender messageSender;
+ /**
+ * Java Serializer.
+ */
+ private JavaSerializer javaSerializer = new JavaSerializer();
/**
* Connect the bus.
@@ -203,8 +211,11 @@
{
try
{
- ObjectMessage jmsMessage = messageSender.getSession().createObjectMessage(message);
+ ObjectMessage jmsMessage;
+ ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+ javaSerializer.serializeObject(message, byteStream);
+ jmsMessage = messageSender.getSession().createObjectMessage(byteStream.toByteArray());
jmsMessage.setStringProperty(DEPLOYMENT_ID, targetDeploymentId);
messageSender.send(jmsMessage);
}
@@ -229,7 +240,9 @@
{
try
{
- notificationSender.send(notificationSender.getSession().createObjectMessage(notification));
+ ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+ javaSerializer.serializeObject(notification, byteStream);
+ notificationSender.send(notificationSender.getSession().createObjectMessage(byteStream.toByteArray()));
}
catch (Exception e)
{
@@ -441,17 +454,22 @@
{
Object objectMessage = ((ObjectMessage) message).getObject();
- if (objectMessage instanceof AbstractNotification)
+ if(objectMessage instanceof byte[])
{
- AbstractNotification notification = (AbstractNotification) objectMessage;
- try
+ Object deserializedObject = deserializeBytes((byte[]) objectMessage);
+
+ if (deserializedObject instanceof AbstractNotification)
{
- getNotificationListener().onNotification(notification);
+ AbstractNotification notification = (AbstractNotification) deserializedObject;
+ try
+ {
+ getNotificationListener().onNotification(notification);
+ }
+ catch (RoutingException e)
+ {
+ logger.error("Deployment '" + getDeploymentId() + "' failed to accept notification '" + notification.getClass().getName() + "' from '" + notification.getDeploymentId() + "'.", e);
+ }
}
- catch (RoutingException e)
- {
- logger.error("Deployment '" + getDeploymentId() + "' failed to accept notification '" + notification.getClass().getName() + "' from '" + notification.getDeploymentId() + "'.", e);
- }
}
}
catch (JMSException e)
@@ -493,16 +511,21 @@
{
Object objectMessage = ((ObjectMessage) message).getObject();
- if (objectMessage instanceof BusMessage)
+ if(objectMessage instanceof byte[])
{
- try
+ Object deserializedObject = deserializeBytes((byte[]) objectMessage);
+
+ if (deserializedObject instanceof BusMessage)
{
- getMessageListener().onMessage((BusMessage) objectMessage);
+ try
+ {
+ getMessageListener().onMessage((BusMessage) deserializedObject);
+ }
+ catch (RoutingException e)
+ {
+ logger.error("Error processing ESB Message: " + objectMessage, e);
+ }
}
- catch (RoutingException e)
- {
- logger.error("Error processing ESB Message: " + objectMessage, e);
- }
}
}
catch (JMSException e)
@@ -511,8 +534,6 @@
}
}
}
-
-
}
/**
@@ -549,4 +570,25 @@
}
}
}
+
+ /**
+ * Derserialize the set of bytes to an object.
+ * @param bytes The object bytes.
+ * @return Deserialized Object.
+ */
+ private Object deserializeBytes(final byte[] bytes)
+ {
+ ByteArrayInputStream instream = new ByteArrayInputStream(bytes);
+
+ try
+ {
+ return javaSerializer.deserializeObject(instream);
+ }
+ catch (SerializationException e)
+ {
+ logger.error("Error deserializing message.", e);
+ }
+
+ return null;
+ }
}
Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/bus/JMSBus_Standalone_Test.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/bus/JMSBus_Standalone_Test.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/test/java/org/jboss/esb/jms/bus/JMSBus_Standalone_Test.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -144,7 +144,7 @@
assertEquals(0, interface2Listener.notificationsReceived.size());
assertEquals(0, interface3Listener.notificationsReceived.size());
interface1.sendNotification(notification);
- Thread.sleep(100);
+ Thread.sleep(500);
assertEquals(0, interface1Listener.notificationsReceived.size());
assertEquals(1, interface2Listener.notificationsReceived.size());
assertEquals(1, interface3Listener.notificationsReceived.size());
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-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -329,7 +329,7 @@
context.setContextObject(DeploymentRuntime.class, this);
context.setContextObject(ResourceLocator.class, resourceLocator);
- logger.info("Starting JBoss ESB deployment: '" + deploymentName + "'.");
+ logger.info("Starting JBoss ESB deployment: '" + deploymentId + "'.");
// Add the pre-installed deployment units e.g. for the "Dead Letter" Service
// and any other that the deployment may have...
@@ -355,7 +355,7 @@
undeploy();
throw new DeploymentException("Unexpected deployment error.", t);
}
- logger.info("JBoss ESB deployment completed successfully: '" + deploymentName + "'.");
+ logger.info("JBoss ESB deployment completed successfully: '" + deploymentId + "'.");
}
finally
{
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-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -30,6 +30,7 @@
import org.jboss.esb.failure.PersistedDeadLetterService;
import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.federate.bus.BusOutboundRouter;
+import org.jboss.esb.federate.bus.BusUtil;
import org.jboss.esb.history.ProcessingEventLogAccessor;
import org.jboss.esb.history.events.OutboundRouterProcessingEvent;
import org.jboss.esb.history.events.ServiceProcessingEvent;
@@ -232,7 +233,7 @@
if (faultTo != null)
{
FaultContext faultContext = InvocationContext.getContext().getFaultContext();
- BusMessage busMessage = BusMessage.create(theMessage, addressingContext);
+ BusMessage busMessage = BusUtil.createBusMessage(theMessage, addressingContext);
faultContext.setFaultMessage(theMessage);
faultContext.setFault(e);
@@ -490,7 +491,7 @@
}
FaultContext faultContext = InvocationContext.getContext().getFaultContext();
- BusMessage busMessage = BusMessage.create(theMessage, addressingContext);
+ BusMessage busMessage = BusUtil.createBusMessage(theMessage, addressingContext);
faultContext.setFaultMessage(theMessage);
faultContext.setFault(theFault);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/InVMDeadLetterService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/InVMDeadLetterService.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/InVMDeadLetterService.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -21,16 +21,19 @@
import org.apache.log4j.Logger;
import org.jboss.esb.api.annotations.Initialize;
+import org.jboss.esb.api.annotations.Property;
import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.context.DeploymentContext;
import org.jboss.esb.api.context.InvocationContext;
+import org.jboss.esb.api.exception.DeploymentException;
import org.jboss.esb.api.message.Message;
import org.jboss.esb.api.service.Service;
import org.jboss.esb.api.service.ServiceException;
-import org.jboss.esb.api.exception.DeploymentException;
import org.jboss.esb.invoke.ServiceInvoker;
import org.jboss.esb.schedule.AbstractScheduleListener;
import org.jboss.esb.schedule.SchedulingException;
+import org.jboss.esb.serialization.java.JavaSerializer;
+import org.jboss.esb.serialization.SerializationException;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
@@ -53,7 +56,8 @@
/**
* Flag to indicate whether or not the Service is expecting delivery of dead messages.
*/
- private boolean expectingMessages = false;
+ @Property(defaultVal = "true")
+ private boolean expectingMessages;
/**
* Exception to throw.
*/
@@ -141,8 +145,12 @@
try
{
logger.info("Redelivering message from DLQ. Addressing: '" + message.getAddressingContext() + "'.");
- serviceInvoker.send(message.getMessage(), message.getAddressingContext());
+ serviceInvoker.send(JavaSerializer.deserialize(message.getMessage()), message.getAddressingContext());
}
+ catch (SerializationException e)
+ {
+ logger.error("Failed to deserialize message bytes from BusMessage.", e);
+ }
finally
{
InvocationContext.setContext(null);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/BusMediator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/BusMediator.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/BusMediator.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -337,6 +337,8 @@
if (monitor != null)
{
+ logger.warn("Received 'online' notification for deployment with deploymentId '" + deploymentId + "'. Already know about this deployment.");
+
// If the monitor for the current deployment says the deployment is not online, and the
// new deployment looks to be the same as the current deployment, just mark
// the current deployment as being online again...
@@ -354,6 +356,8 @@
}
else
{
+ logger.warn("Received 'online' notification for deployment with deploymentId '" + deploymentId + "'. Adding monitor.");
+
// New deployment. Add a monitor...
monitor = new DeploymentMonitor(deployNotification.getServiceSet(), bus, runtime.getContext());
attachDeploymentMonitor(monitor);
@@ -371,13 +375,14 @@
if (monitor != null)
{
+ logger.debug("Received 'undeploy' notification for deployment with deploymentId '" + deploymentId + "'. Removing monitor.");
detachDeploymentMonitor(monitor);
deploymentMonitors.remove(deploymentId);
onlineNotification.getMonitoredDeployments().remove(deploymentId);
}
else
{
- logger.warn("Received undeploy notification for deployment with deploymentId '" + deploymentId + "'. Unknown deployment.");
+ logger.warn("Received 'undeploy' notification for deployment with deploymentId '" + deploymentId + "'. Unknown deployment.");
}
}
}
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-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -184,6 +184,8 @@
*/
public final void addBusMediator(final BusMediator busMediator) throws DeploymentException
{
+ logger.debug("Adding BusMediator instance for bus '" + busMediator.getBus().getClass().getName() + "' for deployment '" + runtime.getDeploymentId() + "'.");
+
if(busMediator.getRuntime() != runtime)
{
throw new DeploymentException("The supplied 'busMediator' instance must be associated with the same DeploymentRuntime instance as the DeploymentCoordinator to which it is being added.");
@@ -199,6 +201,7 @@
// (i.e. it will not, receive them before this message is sent)...
try
{
+ logger.debug("Sending 'online' notification for deployment '" + runtime.getDeploymentId() + "' to bus '" + busMediator.getBus().getClass().getName() + "'.");
busMediator.sendOnlineNotification();
}
catch (RoutingException e)
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-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -19,18 +19,21 @@
*/
package org.jboss.esb.federate;
+import org.apache.log4j.Logger;
+import org.jboss.esb.api.bus.Bus;
+import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.context.DeploymentContext;
import org.jboss.esb.api.context.FaultContext;
import org.jboss.esb.api.context.InvocationContext;
+import org.jboss.esb.api.history.ProcessingEventLog;
+import org.jboss.esb.api.message.Message;
+import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.failure.PersistedDeadLetterService;
-import org.jboss.esb.api.bus.Bus;
-import org.jboss.esb.api.bus.BusMessage;
-import org.jboss.esb.api.history.ProcessingEventLog;
import org.jboss.esb.history.ProcessingEventLogAccessor;
import org.jboss.esb.history.events.BusRouterProcessingEvent;
-import org.jboss.esb.api.message.Message;
import org.jboss.esb.invoke.ServiceInvoker;
-import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.serialization.SerializationException;
+import org.jboss.esb.serialization.java.JavaSerializer;
import org.jboss.esb.util.AssertArgument;
/**
@@ -44,8 +47,11 @@
*/
public class DeploymentMonitor
{
-
/**
+ * Logger.
+ */
+ private static Logger logger = Logger.getLogger(DeploymentMonitor.class);
+ /**
* Time of last received heartbeat.
*/
private long lastHeartbeat;
@@ -66,6 +72,10 @@
* Service Invoker.
*/
private ServiceInvoker serviceInvoker;
+ /**
+ * Java Serializer.
+ */
+ private JavaSerializer javaSerializer = new JavaSerializer();
/**
* Constructor.
@@ -136,6 +146,16 @@
}
/**
+ * Set the DeploymentServiceSets associated with the monitored deployment.
+ *
+ * @param serviceSets The DeploymentServiceSets.
+ */
+ public final void setServiceSets(final DeploymentServiceSets serviceSets)
+ {
+ this.serviceSets = serviceSets;
+ }
+
+ /**
* Does the target deployment have the specified service.
*
* @param serviceName The Service name.
@@ -208,7 +228,15 @@
{
FaultContext faultContext = InvocationContext.getContext().getFaultContext();
- faultContext.setFaultMessage(message.getMessage());
+ try
+ {
+ faultContext.setFaultMessage(JavaSerializer.deserialize(message.getMessage()));
+ }
+ catch (SerializationException e)
+ {
+ logger.error("Failed to deserialize fault Message.", e);
+ return false;
+ }
faultContext.setFault(t);
faultContext.setFaultRecipient(PersistedDeadLetterService.SERVICE_NAME);
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-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -27,6 +27,8 @@
import org.jboss.esb.api.routing.InboundRouter;
import org.jboss.esb.api.routing.RoutingException;
import org.jboss.esb.api.bus.BusMessage;
+import org.jboss.esb.serialization.java.JavaSerializer;
+import org.jboss.esb.serialization.SerializationException;
/**
* Bus inbound router for a specific Service.
@@ -87,9 +89,13 @@
AddressingContext.setContext(addressingContext);
try
{
- Message esbMessage = busMessage.getMessage();
+ Message esbMessage = JavaSerializer.deserialize(busMessage.getMessage());
dispatch(esbMessage, invocationContext);
}
+ catch (SerializationException e)
+ {
+ throw new RoutingException("Received an ESB Message but was unable deserialize the Message bytes.", e);
+ }
finally
{
AddressingContext.setContext(null);
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-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -21,7 +21,6 @@
import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.context.AddressingContext;
-import org.jboss.esb.api.context.InvocationContext;
import org.jboss.esb.api.message.Message;
import org.jboss.esb.api.routing.OutboundRouter;
import org.jboss.esb.api.routing.RoutingException;
@@ -81,10 +80,7 @@
addressingContext.setTo(serviceName);
// Package up the message for shiping over the bus...
- BusMessage busMessage = new BusMessage();
- busMessage.setAddressingContext(addressingContext);
- busMessage.setInvocationParameters(InvocationContext.getContext().getInvocationParameters());
- busMessage.setMessage(message);
+ BusMessage busMessage = BusUtil.createBusMessage(message, addressingContext);
boolean localServiceApplied = (from != null && from.equals(serviceName));
Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusUtil.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusUtil.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusUtil.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -0,0 +1,76 @@
+/*
+ * 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.federate.bus;
+
+import org.jboss.esb.api.bus.BusMessage;
+import org.jboss.esb.api.message.Message;
+import org.jboss.esb.api.context.AddressingContext;
+import org.jboss.esb.api.context.InvocationContext;
+import org.jboss.esb.serialization.java.JavaSerializer;
+import org.jboss.esb.serialization.SerializationException;
+
+import java.io.ByteArrayOutputStream;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public final class BusUtil
+{
+ /**
+ * Java Serializer.
+ */
+ private static JavaSerializer javaSerializer = new JavaSerializer();
+
+ /**
+ * Provate constructor.
+ */
+ private BusUtil()
+ {
+ }
+
+
+ /**
+ * Create a {@link org.jboss.esb.api.bus.BusMessage} instance from the supplied message and the existing thread context.
+ *
+ * @param theMessage Th message.
+ * @param addressingContext The {@link org.jboss.esb.api.context.AddressingContext} for delivery.
+ * @return The bundled {@link org.jboss.esb.api.bus.BusMessage} instance.
+ */
+ public static BusMessage createBusMessage(final Message theMessage, final AddressingContext addressingContext)
+ {
+ BusMessage busMessage = new BusMessage();
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+
+ try
+ {
+ javaSerializer.serialize(theMessage, outStream);
+ }
+ catch (SerializationException e)
+ {
+ throw new RuntimeException("Failed to serialize Message to a byte[].", e);
+ }
+
+ busMessage.setAddressingContext(addressingContext);
+ busMessage.setInvocationParameters(InvocationContext.getContext().getInvocationParameters());
+ busMessage.setMessage(outStream.toByteArray());
+
+ return busMessage;
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusUtil.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/invoke/ServiceInvoker.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/invoke/ServiceInvoker.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/invoke/ServiceInvoker.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -30,15 +30,16 @@
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.deploy.config.ServiceConfig;
+import org.jboss.esb.dispatch.AbstractDispatcher;
import org.jboss.esb.federate.BusMediator;
import org.jboss.esb.federate.DeploymentMonitor;
import org.jboss.esb.federate.bus.BusInboundRouter;
import org.jboss.esb.federate.bus.BusRoutingContext;
+import org.jboss.esb.federate.bus.BusUtil;
import org.jboss.esb.history.ProcessingEventLogAccessor;
import org.jboss.esb.serialization.SerializationException;
import org.jboss.esb.serialization.java.JavaSerializer;
import org.jboss.esb.util.AssertArgument;
-import org.jboss.esb.dispatch.AbstractDispatcher;
import java.util.Iterator;
import java.util.Map;
@@ -198,33 +199,45 @@
InvocationContext thisInvocationContext = InvocationContext.getContext();
Iterator<BusMediator> busMediators = deploymentRuntime.getDeploymentCoordinator().getBusMediators();
- BusMessage busMessage = new BusMessage();
+ BusMessage busMessage = BusUtil.createBusMessage(message, invokeAddressingContext);
- 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...
while (busMediators.hasNext())
{
BusMediator busMediator = busMediators.next();
- Iterator<Map.Entry<String,DeploymentMonitor>> monitors = busMediator.getDeploymentMonitors().entrySet().iterator();
+ Map<String, DeploymentMonitor> monitors = busMediator.getDeploymentMonitors();
+ Iterator<Map.Entry<String,DeploymentMonitor>> monitorsIterator = monitors.entrySet().iterator();
- while (monitors.hasNext())
+ if(logger.isDebugEnabled())
{
- Map.Entry<String, DeploymentMonitor> entry = monitors.next();
+ logger.debug(monitors.size() + " monitors found on Bus '" + busMediator.getBus().getClass().getName() + "'.");
+ }
+
+ while (monitorsIterator.hasNext())
+ {
+ Map.Entry<String, DeploymentMonitor> entry = monitorsIterator.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()))
{
- return monitor.send(busMessage, deploymentId, !monitors.hasNext());
+ return monitor.send(busMessage, deploymentId, !monitorsIterator.hasNext());
}
}
}
+ busMediators = deploymentRuntime.getDeploymentCoordinator().getBusMediators();
+ if(!busMediators.hasNext())
+ {
+ logger.debug("No BusMediator instances attached to deployment runtime '" + deploymentRuntime.getDeploymentId() + "'. Message for '" + invokeAddressingContext.getTo() + "' will be routed to the Dead Letter Queue.");
+ }
+ else
+ {
+ logger.debug("BusMediator instances are attached to deployment runtime '" + deploymentRuntime.getDeploymentId() + "', but none available for routing to '" + invokeAddressingContext.getTo() + "'. Will be routed to the Dead Letter Queue.");
+ }
+
// Route the message to the DLQ...
AbstractDispatcher.routeToDeadLetterService(message, null, invokeAddressingContext, this);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -109,6 +109,19 @@
/**
* Deserialize the {@link Message} from the supplied {@link InputStream}.
*
+ * @param messageBytes Message bytes.
+ * @return The Message.
+ * @throws SerializationException Failed to deserialize message.
+ */
+ public static Message deserialize(byte[] messageBytes) throws SerializationException
+ {
+ ByteArrayInputStream byteStream = new ByteArrayInputStream(messageBytes);
+ return SERIALIZER.deserialize(byteStream);
+ }
+
+ /**
+ * Deserialize the {@link Message} from the supplied {@link InputStream}.
+ *
* @param messageStream The InputStream.
* @return The Message.
* @throws SerializationException Failed to deserialize message.
Modified: 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 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/preinstalled/deadletter.xml 2008-12-02 14:09:58 UTC (rev 24208)
@@ -9,6 +9,7 @@
<services>
<service serviceCategory="JBossESB" serviceName="DeadLetterService" serviceDescription="InVM Dead Letter Service" class="org.jboss.esb.failure.InVMDeadLetterService">
<property name="scheduleResourceId">redeliverSchedule</property>
+ <property name="expectingMessages">true</property>
</service>
</services>
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -23,6 +23,7 @@
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.TestService;
+import org.jboss.esb.serialization.java.JavaSerializer;
import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.service.ServiceException;
import org.jboss.esb.api.service.ServiceName;
@@ -68,7 +69,7 @@
// to the service instance and then to the outrouter...
assertEquals("Hi there!!", serviceA.getMessage());
BusMessage faultMessage = (BusMessage) serviceB.getMessage();
- assertEquals("Hi there!!", faultMessage.getMessage().getPayload());
+ assertEquals("Hi there!!", JavaSerializer.deserialize(faultMessage.getMessage()).getPayload());
assertEquals("Service:A", faultMessage.getAddressingContext().getTo().toString());
assertEquals("Service:B", faultMessage.getAddressingContext().getFaultTo().toString());
assertTrue(faultMessage.getFault() instanceof ServiceException);
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -22,6 +22,7 @@
import junit.framework.TestCase;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestService;
+import org.jboss.esb.serialization.java.JavaSerializer;
import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.deploy.DeploymentRuntime;
@@ -66,7 +67,7 @@
// to the service instance and then to the outrouter...
assertEquals("Hi there!!", serviceA.getMessage());
BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek();
- assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
+ assertEquals("Hi there!!", JavaSerializer.deserialize(dlsMessage.getMessage()).getPayload());
assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
assertTrue(dlsMessage.getFault() instanceof RuntimeException);
assertEquals(faultString, dlsMessage.getFault().getMessage());
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -22,6 +22,7 @@
import junit.framework.TestCase;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestService;
+import org.jboss.esb.serialization.java.JavaSerializer;
import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.service.ServiceException;
import org.jboss.esb.api.service.ServiceName;
@@ -70,7 +71,7 @@
// to the service instance and then to the outrouter...
assertEquals("Hi there!!", serviceA.getMessage());
BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek();
- assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
+ assertEquals("Hi there!!", JavaSerializer.deserialize(dlsMessage.getMessage()).getPayload());
assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
assertTrue(dlsMessage.getFault() instanceof ServiceException);
assertEquals(faultString, dlsMessage.getFault().getMessage());
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java 2008-12-02 14:09:58 UTC (rev 24208)
@@ -23,6 +23,7 @@
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.TestService;
+import org.jboss.esb.serialization.java.JavaSerializer;
import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.routing.RoutingException;
import org.jboss.esb.api.service.ServiceName;
@@ -71,7 +72,7 @@
// to the service instance and then to the outrouter...
assertEquals("Hi there!!", serviceA.getMessage());
BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek();
- assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
+ assertEquals("Hi there!!", JavaSerializer.deserialize(dlsMessage.getMessage()).getPayload());
assertEquals("Service:A", dlsMessage.getAddressingContext().getFrom().toString()); // The service was applied, so the from address should reflect this.
assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
assertTrue(dlsMessage.getFault() instanceof RoutingException);
Modified: 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 2008-12-02 14:03:18 UTC (rev 24207)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/preinstalled/deadletter.xml 2008-12-02 14:09:58 UTC (rev 24208)
@@ -9,6 +9,7 @@
<services>
<service serviceCategory="JBossESB" serviceName="DeadLetterService" serviceDescription="InVM Dead Letter Service" class="org.jboss.esb.failure.InVMDeadLetterService">
<property name="scheduleResourceId">redeliverSchedule</property>
+ <property name="expectingMessages">false</property>
</service>
</services>
More information about the jboss-svn-commits
mailing list