Commits

Marcin Grzejszczak committed a4ff916

Fixing wrong commit of Spring JMS project (by mistake commited a version just before some code cleaning)

Comments (0)

Files changed (58)

Spring JMS/pom.xml

 		<maven.compiler.source>1.6</maven.compiler.source>
 		<maven.compiler.target>1.6</maven.compiler.target>
 
-		<vaadin.version>6.7.5</vaadin.version>
-		<spring.version>3.1.0.RELEASE</spring.version>
-		<aspectj.version>1.6.11</aspectj.version>
-
-		<!-- Plugin versions -->
-		<aspectj-maven-plugin.version>1.4</aspectj-maven-plugin.version>
-		<jetty-maven-plugin.version>8.0.4.v20111024</jetty-maven-plugin.version>
-
-		<jtds.version>1.2.4</jtds.version>
-		<jdto.version>0.8</jdto.version>
-
+		<spring.version>3.1.1.RELEASE</spring.version>
 	</properties>
 	<repositories>
 		<repository>
-			<id>vaadin-addons</id>
-			<url>http://maven.vaadin.com/vaadin-addons</url>
-		</repository>
-		<repository>
-			<id>com.juancavallotti</id>
-			<name>jdto</name>
-			<url>http://juancavallotti.com/maven2</url>
-			<layout>default</layout>
-		</repository>
-		<repository>
 			<id>spring-release</id>
 			<url>http://maven.springframework.org/release</url>
 		</repository>
-		<repository>
-			<id>sonatype-joda-staging</id>
-			<name>Sonatype OSS staging repository</name>
-			<url>http://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
-			<layout>default</layout>
-		</repository>
-		<repository>
-			<id>joda-time</id>
-			<url>http://repo1.maven.org/maven2</url>
-		</repository>
-		<repository>
-            <id>maven-us-nuxeo</id>
-            <url>https://maven-us.nuxeo.org/nexus/content/groups/public</url>
-        </repository>
 	</repositories>
 
 	<dependencies>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>4.10</version>
-		</dependency>
-		<dependency>
-			<groupId>org.mockito</groupId>
-			<artifactId>mockito-all</artifactId>
-			<version>1.9.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.mockito</groupId>
-			<artifactId>mockito-core</artifactId>
-			<version>1.9.0</version>
-		</dependency>
-		<dependency>
-			<groupId>com.vaadin</groupId>
-			<artifactId>vaadin</artifactId>
-			<version>${vaadin.version}</version>
-		</dependency>
 		<!-- Spring -->
 		<dependency>
 			<groupId>org.springframework</groupId>
 			<artifactId>spring-core</artifactId>
 			<version>${spring.version}</version>
 		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-beans</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-context</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-web</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-aspects</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-aop</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-tx</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-orm</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework.security</groupId>
-			<artifactId>spring-security-core</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework.security</groupId>
-			<artifactId>spring-security-config</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework.security</groupId>
-			<artifactId>spring-security-web</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<!-- Required due to a bug in Spring, see https://jira.springsource.org/browse/SPR-6819 -->
-		<dependency>
-			<groupId>javax.persistence</groupId>
-			<artifactId>persistence-api</artifactId>
-			<version>1.0</version>
-			<optional>true</optional>
-		</dependency>
-		<!-- AspectJ dependencies -->
-		<dependency>
-			<groupId>org.aspectj</groupId>
-			<artifactId>aspectjrt</artifactId>
-			<version>${aspectj.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.aspectj</groupId>
-			<artifactId>aspectjweaver</artifactId>
-			<version>1.6.11</version>
-		</dependency>
-		<!-- JTDS MS SQL connector -->
-		<dependency>
-			<groupId>net.sourceforge.jtds</groupId>
-			<artifactId>jtds</artifactId>
-			<version>${jtds.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.openejb</groupId>
-			<artifactId>commons-dbcp-all</artifactId>
-			<version>1.3-r699049</version>
-		</dependency>
-		<!-- Hibernate -->
-		<dependency>
-			<groupId>org.hibernate</groupId>
-			<artifactId>hibernate-commons-annotations</artifactId>
-			<version>3.2.0.Final</version>
-		</dependency>
-		<dependency>
-			<groupId>org.hibernate</groupId>
-			<artifactId>hibernate-core</artifactId>
-			<version>3.6.7.Final</version>
-		</dependency>
-		<dependency><!-- java bytecode processor -->
-			<groupId>javassist</groupId>
-			<artifactId>javassist</artifactId>
-			<version>3.4.GA</version>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-log4j12</artifactId>
-			<version>1.5.2</version>
-		</dependency>
-		<!-- Vaadin addons -->
-		<dependency>
-			<groupId>org.vaadin.addons</groupId>
-			<artifactId>blackboard</artifactId>
-			<version>2.1.1</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>javax.servlet-api</artifactId>
-			<version>3.0.1</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>com.juancavallotti</groupId>
-			<artifactId>jdto</artifactId>
-			<version>${jdto.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-lang</groupId>
-			<artifactId>commons-lang</artifactId>
-			<version>2.6</version>
-		</dependency>
-		<!-- java API for Microsoft documents -->
-		<dependency>
-			<groupId>org.apache.poi</groupId>
-			<artifactId>poi-ooxml</artifactId>
-			<version>3.6</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-beanutils</groupId>
-			<artifactId>commons-beanutils</artifactId>
-			<version>1.8.3</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-beanutils</groupId>
-			<artifactId>
-             		commons-beanutils-bean-collections
-             	</artifactId>
-			<version>1.8.3</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-beanutils</groupId>
-			<artifactId>commons-beanutils-core</artifactId>
-			<version>1.8.3</version>
-		</dependency>
-		<dependency>
-			<groupId>joda-time</groupId>
-			<artifactId>joda-time</artifactId>
-			<version>2.1</version>
-		</dependency>
-		<dependency>
-			<groupId>mysql</groupId>
-			<artifactId>mysql-connector-java</artifactId>
-			<version>5.1.18</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-core</artifactId>
-			<version>2.9.2</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-activemq</artifactId>
-			<version>1.1.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.activemq</groupId>
-			<artifactId>activemq-core</artifactId>
-			<version>5.7.0</version>
-		</dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
 		<dependency>
 			<groupId>org.springframework</groupId>
 			<artifactId>spring-jms</artifactId>
-			<version>3.1.1.RELEASE</version>
+			<version>${spring.version}</version>
 		</dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-oxm</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-core</artifactId>
+            <version>5.7.0</version>
+        </dependency>
 		<dependency>
 			<groupId>com.sun.xml.bind</groupId>
 			<artifactId>jaxb-impl</artifactId>
 			<version>2.2.6</version>
 		</dependency>
 		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-oxm</artifactId>
-			<version>3.1.1.RELEASE</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-spring</artifactId>
-			<version>2.9.2</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.activemq</groupId>
-			<artifactId>activemq-camel</artifactId>
-			<version>5.6.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.camel</groupId>
-			<artifactId>camel-jms</artifactId>
-			<version>2.9.2</version>
-		</dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.6.6</version>
+        </dependency>
 	</dependencies>
 </project>

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/enricher/AgeEnricher.java

+package pl.grzejszczak.marcin.camel.enricher;
+
+import java.util.Random;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
+
+@Component("AgeEnricher")
+public class AgeEnricher implements Enrichable<PlayerDetails> {
+	private static final Logger LOGGER = LoggerFactory.getLogger(AgeEnricher.class);
+
+	@Override
+	public void enrich(PlayerDetails inputObject) {
+		LOGGER.debug("Enriching player [{}] with age data", new Object[] { inputObject.getSurname() });
+		// Simulating accessing DB or some other service
+		try {
+			Thread.sleep(2000);
+		} catch (InterruptedException e) {
+			LOGGER.error("Exception while sleeping occured", e);
+		}
+		inputObject.setAge(new Random().nextInt(35));
+	}
+
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/enricher/ClubEnricher.java

+package pl.grzejszczak.marcin.camel.enricher;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
+
+@Component("ClubEnricher")
+public class ClubEnricher implements Enrichable<PlayerDetails> {
+
+	private static final Logger LOGGER = LoggerFactory.getLogger(ClubEnricher.class);
+
+	@Override
+	public void enrich(PlayerDetails inputObject) {
+		LOGGER.debug("Enriching player [{}] with club data", new Object[] { inputObject.getSurname() });
+		// Simulating accessing DB or some other service
+		try {
+			Thread.sleep(2000);
+		} catch (InterruptedException e) {
+			LOGGER.error("Exception while sleeping occured", e);
+		}
+		inputObject.setTeamName("Borussia Dortmund");
+	}
+
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/enricher/Enrichable.java

+package pl.grzejszczak.marcin.camel.enricher;
+
+public interface Enrichable<T> {
+	void enrich(T inputObject);
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/jaxb/Convertable.java

+package pl.grzejszczak.marcin.camel.jaxb;
+
+public interface Convertable<T> {
+	String marshal(T object);
+
+	T unmarshal(String objectAsString);
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/jaxb/PlayerDetailsConverter.java

+package pl.grzejszczak.marcin.camel.jaxb;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.activemq.util.ByteArrayInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
+
+@Component("PlayerDetailsConverter")
+public class PlayerDetailsConverter implements Convertable<PlayerDetails> {
+	private static final Logger LOGGER = LoggerFactory.getLogger(PlayerDetailsConverter.class);
+
+	private final JAXBContext jaxbContext;
+	private final Marshaller jaxbMarshaller;
+	private final Unmarshaller jaxbUnmarshaller;
+
+	public PlayerDetailsConverter() throws JAXBException {
+		jaxbContext = JAXBContext.newInstance(PlayerDetails.class);
+		jaxbMarshaller = jaxbContext.createMarshaller();
+		jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+		jaxbUnmarshaller = jaxbContext.createUnmarshaller();
+	}
+
+	@Override
+	public String marshal(PlayerDetails object) {
+		OutputStream stream = new ByteArrayOutputStream();
+		try {
+			jaxbMarshaller.marshal(object, stream);
+		} catch (JAXBException e) {
+			LOGGER.error("Exception occured while marshalling", e);
+		}
+		return stream.toString();
+	}
+
+	@Override
+	public PlayerDetails unmarshal(String objectAsString) {
+		try {
+			return (PlayerDetails) jaxbUnmarshaller.unmarshal(new ByteArrayInputStream(objectAsString.getBytes()));
+		} catch (JAXBException e) {
+			LOGGER.error("Exception occured while marshalling", e);
+		}
+		return null;
+	}
+
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/jaxb/generated/ObjectFactory.java

+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.11.05 at 09:23:22 PM CET 
+//
+
+
+package pl.grzejszczak.marcin.camel.jaxb.generated;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each 
+ * Java content interface and Java element interface 
+ * generated in the pl.grzejszczak.marcin.camel.jaxb.generated package. 
+ * <p>An ObjectFactory allows you to programatically 
+ * construct new instances of the Java representation 
+ * for XML content. The Java representation of XML 
+ * content can consist of schema derived interfaces 
+ * and classes representing the binding of schema 
+ * type definitions, element declarations and model 
+ * groups.  Factory methods for each of these are 
+ * provided in this class.
+ * 
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+    /**
+     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.grzejszczak.marcin.camel.jaxb.generated
+     * 
+     */
+    public ObjectFactory() {
+    }
+
+    /**
+     * Create an instance of {@link PlayerDetails }
+     * 
+     */
+    public PlayerDetails createPlayerDetails() {
+        return new PlayerDetails();
+    }
+
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/jaxb/generated/PlayerDetails.java

+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.11.05 at 09:23:22 PM CET 
+//
+
+
+package pl.grzejszczak.marcin.camel.jaxb.generated;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         &lt;element name="Surname" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         &lt;element name="Position" type="{}PositionType"/>
+ *         &lt;element name="Age" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *         &lt;element name="TeamName" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+    "name",
+    "surname",
+    "position",
+    "age",
+    "teamName"
+})
+@XmlRootElement(name = "PlayerDetails")
+public class PlayerDetails {
+
+    @XmlElement(name = "Name", required = true)
+    protected String name;
+    @XmlElement(name = "Surname", required = true)
+    protected String surname;
+    @XmlElement(name = "Position", required = true)
+    protected PositionType position;
+    @XmlElement(name = "Age")
+    protected int age;
+    @XmlElement(name = "TeamName", required = true)
+    protected String teamName;
+
+    /**
+     * Gets the value of the name property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Sets the value of the name property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setName(String value) {
+        this.name = value;
+    }
+
+    /**
+     * Gets the value of the surname property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getSurname() {
+        return surname;
+    }
+
+    /**
+     * Sets the value of the surname property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setSurname(String value) {
+        this.surname = value;
+    }
+
+    /**
+     * Gets the value of the position property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link PositionType }
+     *     
+     */
+    public PositionType getPosition() {
+        return position;
+    }
+
+    /**
+     * Sets the value of the position property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link PositionType }
+     *     
+     */
+    public void setPosition(PositionType value) {
+        this.position = value;
+    }
+
+    /**
+     * Gets the value of the age property.
+     * 
+     */
+    public int getAge() {
+        return age;
+    }
+
+    /**
+     * Sets the value of the age property.
+     * 
+     */
+    public void setAge(int value) {
+        this.age = value;
+    }
+
+    /**
+     * Gets the value of the teamName property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getTeamName() {
+        return teamName;
+    }
+
+    /**
+     * Sets the value of the teamName property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setTeamName(String value) {
+        this.teamName = value;
+    }
+
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/jaxb/generated/PositionType.java

+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2012.11.05 at 09:23:22 PM CET 
+//
+
+
+package pl.grzejszczak.marcin.camel.jaxb.generated;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for PositionType.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="PositionType">
+ *   &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     &lt;enumeration value="GK"/>
+ *     &lt;enumeration value="DEF"/>
+ *     &lt;enumeration value="MID"/>
+ *     &lt;enumeration value="ATT"/>
+ *   &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ * 
+ */
+@XmlType(name = "PositionType")
+@XmlEnum
+public enum PositionType {
+
+    GK,
+    DEF,
+    MID,
+    ATT;
+
+    public String value() {
+        return name();
+    }
+
+    public static PositionType fromValue(String v) {
+        return valueOf(v);
+    }
+
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/manual/ActiveMQRouter.java

+package pl.grzejszczak.marcin.camel.manual;
+
+import java.io.File;
+import java.util.Scanner;
+
+import javax.jms.JMSException;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.Resource;
+
+import pl.grzejszczak.marcin.camel.jaxb.PlayerDetailsConverter;
+import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
+import pl.grzejszczak.marcin.camel.manual.jms.Sender;
+
+public class ActiveMQRouter {
+
+	/**
+	 * @param args
+	 * @throws JMSException
+	 */
+	public static void main(String[] args) throws Exception {
+		ApplicationContext context = new ClassPathXmlApplicationContext("/camel/jmsApplicationContext.xml");
+		@SuppressWarnings("unchecked")
+		Sender<PlayerDetails> sender = (Sender<PlayerDetails>) context.getBean("originPlayerSender");
+
+		Resource resource = new ClassPathResource("/camel/RobertLewandowski.xml");
+
+		Scanner scanner = new Scanner(new File(resource.getURI())).useDelimiter("\\Z");
+		String contents = scanner.next();
+
+		PlayerDetailsConverter converter = context.getBean(PlayerDetailsConverter.class);
+
+		sender.sendMessage(converter.unmarshal(contents));
+	}
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/manual/jms/FinalListenerImpl.java

+package pl.grzejszczak.marcin.camel.manual.jms;
+
+import javax.jms.BytesMessage;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.support.converter.MessageConverter;
+import org.springframework.stereotype.Component;
+
+import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
+
+@Component
+public class FinalListenerImpl implements MessageListener {
+
+	private static final Logger LOG = LoggerFactory.getLogger(FinalListenerImpl.class);
+
+	@Autowired
+	private MessageConverter messageConverter;
+
+	@Override
+	public void onMessage(Message message) {
+		if (!(message instanceof BytesMessage)) {
+			LOG.error("Wrong msg!");
+			return;
+		}
+
+		PlayerDetails playerDetails = null;
+		try {
+			playerDetails = (PlayerDetails) messageConverter.fromMessage(message);
+
+			if (playerDetails.getTeamName() != null) {
+				LOG.debug("Message already enriched! Shutting down the system");
+				System.exit(0);
+			} else {
+				LOG.debug("The message should have been enriched but wasn't");
+				System.exit(1);
+			}
+
+		} catch (Exception e) {
+			LOG.error("Exception occured", e);
+		}
+	}
+
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/manual/jms/ListenerImpl.java

+package pl.grzejszczak.marcin.camel.manual.jms;
+
+import java.util.List;
+
+import javax.jms.BytesMessage;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.jms.support.converter.MessageConverter;
+import org.springframework.stereotype.Component;
+
+import pl.grzejszczak.marcin.camel.enricher.Enrichable;
+import pl.grzejszczak.marcin.camel.jaxb.Convertable;
+import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
+
+@Component
+public class ListenerImpl implements MessageListener {
+
+	private static final Logger LOG = LoggerFactory.getLogger(ListenerImpl.class);
+
+	@Autowired
+	private Convertable<PlayerDetails> playerDetailsConverter;
+
+	@Autowired
+	private List<Enrichable<PlayerDetails>> listOfEnrichers;
+
+	@Autowired
+	private MessageConverter messageConverter;
+
+	@Autowired
+	@Qualifier("destinationPlayerSender")
+	private Sender<PlayerDetails> sender;
+
+	@Override
+	public void onMessage(Message message) {
+		if (!(message instanceof BytesMessage)) {
+			LOG.error("Wrong msg!");
+			return;
+		}
+
+		PlayerDetails playerDetails = null;
+		try {
+			playerDetails = (PlayerDetails) messageConverter.fromMessage(message);
+
+			LOG.debug("Enriching the input message");
+			for (Enrichable<PlayerDetails> enrichable : listOfEnrichers) {
+				enrichable.enrich(playerDetails);
+			}
+			LOG.debug("Enriched text message: [{}]", new Object[] { playerDetailsConverter.marshal(playerDetails) });
+			sender.sendMessage(playerDetails);
+		} catch (Exception e) {
+			LOG.error("Exception occured", e);
+		}
+
+	}
+
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/manual/jms/PlayerDetailsSenderImpl.java

+package pl.grzejszczak.marcin.camel.manual.jms;
+
+import javax.jms.Destination;
+import javax.jms.JMSException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.stereotype.Component;
+
+import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
+
+@Component
+public class PlayerDetailsSenderImpl implements Sender<PlayerDetails> {
+
+	private static final Logger LOGGER = LoggerFactory.getLogger(PlayerDetailsSenderImpl.class);
+
+	private Destination destination;
+
+	@Autowired
+	private JmsTemplate jmsTemplate;
+
+	@Override
+	public void sendMessage(final PlayerDetails object) throws JMSException {
+		LOGGER.debug("Sending [{}] to topic [{}]", new Object[] { object, destination });
+		jmsTemplate.convertAndSend(destination, object);
+	}
+
+	public Destination getDestination() {
+		return destination;
+	}
+
+	public void setDestination(Destination destination) {
+		this.destination = destination;
+	}
+
+}

Spring JMS/src/main/java/pl/grzejszczak/marcin/camel/manual/jms/Sender.java

+package pl.grzejszczak.marcin.camel.manual.jms;
+
+public interface Sender<T> {
+	void sendMessage(T object) throws Exception;
+}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/CamelRouter.java

-package pl.grzejszczak.marcin.camel;
-
-import java.io.File;
-import java.util.Scanner;
-
-import javax.jms.JMSException;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.spring.SpringCamelContext;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-
-import pl.grzejszczak.marcin.camel.jaxb.PlayerDetailsConverter;
-import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
-import pl.grzejszczak.marcin.camel.manual.jms.Sender;
-
-public class CamelRouter {
-	/**
-	 * @param args
-	 * @throws JMSException
-	 */
-	public static void main(String[] args) throws Exception {
-		ApplicationContext context = new ClassPathXmlApplicationContext("/camel/camelContext.xml");
-		@SuppressWarnings("unchecked")
-		Sender<PlayerDetails> sender = (Sender<PlayerDetails>) context.getBean("originPlayerSender");
-
-		Resource resource = new ClassPathResource("/camel/RobertLewandowski.xml");
-
-		Scanner scanner = new Scanner(new File(resource.getURI())).useDelimiter("\\Z");
-		String contents = scanner.next();
-
-		PlayerDetailsConverter converter = context.getBean(PlayerDetailsConverter.class);
-
-		CamelContext camelContext = new SpringCamelContext(context);
-		camelContext.start();
-
-		sender.sendMessage(converter.unmarshal(contents));
-	}
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/builder/MyRoute.java

-package pl.grzejszczak.marcin.camel.builder;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.spring.SpringRouteBuilder;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-@Component
-public class MyRoute extends SpringRouteBuilder {
-
-	@Value("${jms.origin}")
-	private String origin;
-
-	@Value("${jms.destination}")
-	private String destination;
-
-	// @Autowired
-	// private List<Enrichable<PlayerDetails>> listOfEnrichers;
-
-	@Override
-	public void configure() throws Exception {
-		from("activemq:queue:" + origin).process(new Processor() {
-
-			@Override
-			public void process(Exchange exchange) throws Exception {
-				// for (Enrichable<PlayerDetails> enrichable : listOfEnrichers)
-				// {
-				// enrichable.enrich((PlayerDetails)
-				// exchange.getIn().getBody());
-				// }
-
-			}
-		}).to("activemq:queue:" + destination);
-	}
-
-	public String getDestination() {
-		return destination;
-	}
-
-	public void setDestination(String destination) {
-		this.destination = destination;
-	}
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/enricher/AgeEnricher.java

-package pl.grzejszczak.marcin.camel.enricher;
-
-import java.util.Random;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
-
-@Component("AgeEnricher")
-public class AgeEnricher implements Enrichable<PlayerDetails> {
-	private static final Logger LOGGER = LoggerFactory.getLogger(AgeEnricher.class);
-
-	@Override
-	public void enrich(PlayerDetails inputObject) {
-		LOGGER.debug("Enriching player [{}] with age data", new Object[] { inputObject.getSurname() });
-		// Simulating accessing DB or some other service
-		try {
-			Thread.sleep(2000);
-		} catch (InterruptedException e) {
-			LOGGER.error("Exception while sleeping occured", e);
-		}
-		inputObject.setAge(new Random().nextInt(35));
-	}
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/enricher/ClubEnricher.java

-package pl.grzejszczak.marcin.camel.enricher;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
-
-@Component("ClubEnricher")
-public class ClubEnricher implements Enrichable<PlayerDetails> {
-
-	private static final Logger LOGGER = LoggerFactory.getLogger(ClubEnricher.class);
-
-	@Override
-	public void enrich(PlayerDetails inputObject) {
-		LOGGER.debug("Enriching player [{}] with club data", new Object[] { inputObject.getSurname() });
-		// Simulating accessing DB or some other service
-		try {
-			Thread.sleep(2000);
-		} catch (InterruptedException e) {
-			LOGGER.error("Exception while sleeping occured", e);
-		}
-		inputObject.setTeamName("Borussia Dortmund");
-	}
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/enricher/Enrichable.java

-package pl.grzejszczak.marcin.camel.enricher;
-
-public interface Enrichable<T> {
-	void enrich(T inputObject);
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/jaxb/Convertable.java

-package pl.grzejszczak.marcin.camel.jaxb;
-
-public interface Convertable<T> {
-	String marshal(T object);
-
-	T unmarshal(String objectAsString);
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/jaxb/PlayerDetailsConverter.java

-package pl.grzejszczak.marcin.camel.jaxb;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.activemq.util.ByteArrayInputStream;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
-
-@Component("PlayerDetailsConverter")
-public class PlayerDetailsConverter implements Convertable<PlayerDetails> {
-	private static final Logger LOGGER = LoggerFactory.getLogger(PlayerDetailsConverter.class);
-
-	private final JAXBContext jaxbContext;
-	private final Marshaller jaxbMarshaller;
-	private final Unmarshaller jaxbUnmarshaller;
-
-	public PlayerDetailsConverter() throws JAXBException {
-		jaxbContext = JAXBContext.newInstance(PlayerDetails.class);
-		jaxbMarshaller = jaxbContext.createMarshaller();
-		jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
-		jaxbUnmarshaller = jaxbContext.createUnmarshaller();
-	}
-
-	@Override
-	public String marshal(PlayerDetails object) {
-		OutputStream stream = new ByteArrayOutputStream();
-		try {
-			jaxbMarshaller.marshal(object, stream);
-		} catch (JAXBException e) {
-			LOGGER.error("Exception occured while marshalling", e);
-		}
-		return stream.toString();
-	}
-
-	@Override
-	public PlayerDetails unmarshal(String objectAsString) {
-		try {
-			return (PlayerDetails) jaxbUnmarshaller.unmarshal(new ByteArrayInputStream(objectAsString.getBytes()));
-		} catch (JAXBException e) {
-			LOGGER.error("Exception occured while marshalling", e);
-		}
-		return null;
-	}
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/jaxb/generated/ObjectFactory.java

-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6 
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
-// Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.11.05 at 09:23:22 PM CET 
-//
-
-
-package pl.grzejszczak.marcin.camel.jaxb.generated;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each 
- * Java content interface and Java element interface 
- * generated in the pl.grzejszczak.marcin.camel.jaxb.generated package. 
- * <p>An ObjectFactory allows you to programatically 
- * construct new instances of the Java representation 
- * for XML content. The Java representation of XML 
- * content can consist of schema derived interfaces 
- * and classes representing the binding of schema 
- * type definitions, element declarations and model 
- * groups.  Factory methods for each of these are 
- * provided in this class.
- * 
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
-    /**
-     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: pl.grzejszczak.marcin.camel.jaxb.generated
-     * 
-     */
-    public ObjectFactory() {
-    }
-
-    /**
-     * Create an instance of {@link PlayerDetails }
-     * 
-     */
-    public PlayerDetails createPlayerDetails() {
-        return new PlayerDetails();
-    }
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/jaxb/generated/PlayerDetails.java

-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6 
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
-// Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.11.05 at 09:23:22 PM CET 
-//
-
-
-package pl.grzejszczak.marcin.camel.jaxb.generated;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- * 
- * <p>The following schema fragment specifies the expected content contained within this class.
- * 
- * <pre>
- * &lt;complexType>
- *   &lt;complexContent>
- *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       &lt;sequence>
- *         &lt;element name="Name" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         &lt;element name="Surname" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         &lt;element name="Position" type="{}PositionType"/>
- *         &lt;element name="Age" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         &lt;element name="TeamName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *       &lt;/sequence>
- *     &lt;/restriction>
- *   &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- * 
- * 
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
-    "name",
-    "surname",
-    "position",
-    "age",
-    "teamName"
-})
-@XmlRootElement(name = "PlayerDetails")
-public class PlayerDetails {
-
-    @XmlElement(name = "Name", required = true)
-    protected String name;
-    @XmlElement(name = "Surname", required = true)
-    protected String surname;
-    @XmlElement(name = "Position", required = true)
-    protected PositionType position;
-    @XmlElement(name = "Age")
-    protected int age;
-    @XmlElement(name = "TeamName", required = true)
-    protected String teamName;
-
-    /**
-     * Gets the value of the name property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * Sets the value of the name property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
-     */
-    public void setName(String value) {
-        this.name = value;
-    }
-
-    /**
-     * Gets the value of the surname property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
-     */
-    public String getSurname() {
-        return surname;
-    }
-
-    /**
-     * Sets the value of the surname property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
-     */
-    public void setSurname(String value) {
-        this.surname = value;
-    }
-
-    /**
-     * Gets the value of the position property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link PositionType }
-     *     
-     */
-    public PositionType getPosition() {
-        return position;
-    }
-
-    /**
-     * Sets the value of the position property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link PositionType }
-     *     
-     */
-    public void setPosition(PositionType value) {
-        this.position = value;
-    }
-
-    /**
-     * Gets the value of the age property.
-     * 
-     */
-    public int getAge() {
-        return age;
-    }
-
-    /**
-     * Sets the value of the age property.
-     * 
-     */
-    public void setAge(int value) {
-        this.age = value;
-    }
-
-    /**
-     * Gets the value of the teamName property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
-     */
-    public String getTeamName() {
-        return teamName;
-    }
-
-    /**
-     * Sets the value of the teamName property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
-     */
-    public void setTeamName(String value) {
-        this.teamName = value;
-    }
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/jaxb/generated/PositionType.java

-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6 
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
-// Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2012.11.05 at 09:23:22 PM CET 
-//
-
-
-package pl.grzejszczak.marcin.camel.jaxb.generated;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for PositionType.
- * 
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * &lt;simpleType name="PositionType">
- *   &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     &lt;enumeration value="GK"/>
- *     &lt;enumeration value="DEF"/>
- *     &lt;enumeration value="MID"/>
- *     &lt;enumeration value="ATT"/>
- *   &lt;/restriction>
- * &lt;/simpleType>
- * </pre>
- * 
- */
-@XmlType(name = "PositionType")
-@XmlEnum
-public enum PositionType {
-
-    GK,
-    DEF,
-    MID,
-    ATT;
-
-    public String value() {
-        return name();
-    }
-
-    public static PositionType fromValue(String v) {
-        return valueOf(v);
-    }
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/manual/ActiveMQRouter.java

-package pl.grzejszczak.marcin.camel.manual;
-
-import java.io.File;
-import java.util.Scanner;
-
-import javax.jms.JMSException;
-
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-
-import pl.grzejszczak.marcin.camel.jaxb.PlayerDetailsConverter;
-import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
-import pl.grzejszczak.marcin.camel.manual.jms.Sender;
-
-public class ActiveMQRouter {
-
-	/**
-	 * @param args
-	 * @throws JMSException
-	 */
-	public static void main(String[] args) throws Exception {
-		ApplicationContext context = new ClassPathXmlApplicationContext("/camel/jmsApplicationContext.xml");
-		@SuppressWarnings("unchecked")
-		Sender<PlayerDetails> sender = (Sender<PlayerDetails>) context.getBean("originPlayerSender");
-
-		Resource resource = new ClassPathResource("/camel/RobertLewandowski.xml");
-
-		Scanner scanner = new Scanner(new File(resource.getURI())).useDelimiter("\\Z");
-		String contents = scanner.next();
-
-		PlayerDetailsConverter converter = context.getBean(PlayerDetailsConverter.class);
-
-		sender.sendMessage(converter.unmarshal(contents));
-	}
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/manual/jms/FinalListenerImpl.java

-package pl.grzejszczak.marcin.camel.manual.jms;
-
-import javax.jms.BytesMessage;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jms.support.converter.MessageConverter;
-import org.springframework.stereotype.Component;
-
-import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
-
-@Component
-public class FinalListenerImpl implements MessageListener {
-
-	private static final Logger LOG = LoggerFactory.getLogger(FinalListenerImpl.class);
-
-	@Autowired
-	private MessageConverter messageConverter;
-
-	@Override
-	public void onMessage(Message message) {
-		if (!(message instanceof BytesMessage)) {
-			LOG.error("Wrong msg!");
-			return;
-		}
-
-		PlayerDetails playerDetails = null;
-		try {
-			playerDetails = (PlayerDetails) messageConverter.fromMessage(message);
-
-			if (playerDetails.getTeamName() != null) {
-				LOG.debug("Message already enriched! Shutting down the system");
-				System.exit(0);
-			} else {
-				LOG.debug("The message should have been enriched but wasn't");
-				System.exit(1);
-			}
-
-		} catch (Exception e) {
-			LOG.error("Exception occured", e);
-		}
-	}
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/manual/jms/ListenerImpl.java

-package pl.grzejszczak.marcin.camel.manual.jms;
-
-import java.util.List;
-
-import javax.jms.BytesMessage;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.jms.support.converter.MessageConverter;
-import org.springframework.stereotype.Component;
-
-import pl.grzejszczak.marcin.camel.enricher.Enrichable;
-import pl.grzejszczak.marcin.camel.jaxb.Convertable;
-import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
-
-@Component
-public class ListenerImpl implements MessageListener {
-
-	private static final Logger LOG = LoggerFactory.getLogger(ListenerImpl.class);
-
-	@Autowired
-	private Convertable<PlayerDetails> playerDetailsConverter;
-
-	@Autowired
-	private List<Enrichable<PlayerDetails>> listOfEnrichers;
-
-	@Autowired
-	private MessageConverter messageConverter;
-
-	@Autowired
-	@Qualifier("destinationPlayerSender")
-	private Sender<PlayerDetails> sender;
-
-	@Override
-	public void onMessage(Message message) {
-		if (!(message instanceof BytesMessage)) {
-			LOG.error("Wrong msg!");
-			return;
-		}
-
-		PlayerDetails playerDetails = null;
-		try {
-			playerDetails = (PlayerDetails) messageConverter.fromMessage(message);
-
-			LOG.debug("Enriching the input message");
-			for (Enrichable<PlayerDetails> enrichable : listOfEnrichers) {
-				enrichable.enrich(playerDetails);
-			}
-			LOG.debug("Enriched text message: [{}]", new Object[] { playerDetailsConverter.marshal(playerDetails) });
-			sender.sendMessage(playerDetails);
-		} catch (Exception e) {
-			LOG.error("Exception occured", e);
-		}
-
-	}
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/manual/jms/PlayerDetailsSenderImpl.java

-package pl.grzejszczak.marcin.camel.manual.jms;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jms.core.JmsTemplate;
-import org.springframework.stereotype.Component;
-
-import pl.grzejszczak.marcin.camel.jaxb.generated.PlayerDetails;
-
-@Component
-public class PlayerDetailsSenderImpl implements Sender<PlayerDetails> {
-
-	private static final Logger LOGGER = LoggerFactory.getLogger(PlayerDetailsSenderImpl.class);
-
-	private Destination destination;
-
-	@Autowired
-	private JmsTemplate jmsTemplate;
-
-	@Override
-	public void sendMessage(final PlayerDetails object) throws JMSException {
-		LOGGER.debug("Sending [{}] to topic [{}]", new Object[] { object, destination });
-		jmsTemplate.convertAndSend(destination, object);
-	}
-
-	public Destination getDestination() {
-		return destination;
-	}
-
-	public void setDestination(Destination destination) {
-		this.destination = destination;
-	}
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/camel/manual/jms/Sender.java

-package pl.grzejszczak.marcin.camel.manual.jms;
-
-public interface Sender<T> {
-	void sendMessage(T object) throws Exception;
-}

Spring JMS/src/main/pl/grzejszczak/marcin/entity/Absence.java

-package pl.grzejszczak.marcin.entity;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Version;
-
-/**
- * Absence generated by hbm2java
- */
-@Entity
-@Table(name = "ABSENCE")
-@Inheritance(strategy = InheritanceType.JOINED)
-public class Absence implements java.io.Serializable {
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = -4572952141587410338L;
-	private int id;
-	private int version;
-	private Date startDate;
-	private Date endDate;
-
-	public Absence() {
-	}
-
-	@Id
-	@Column(name = "ID", unique = true, nullable = false)
-	@GeneratedValue(strategy = GenerationType.IDENTITY)
-	public int getId() {
-		return this.id;
-	}
-
-	public void setId(int id) {
-		this.id = id;
-	}
-
-	@Version
-	@Column(name = "VERSION", nullable = false)
-	public int getVersion() {
-		return this.version;
-	}
-
-	public void setVersion(int version) {
-		this.version = version;
-	}
-
-	@Temporal(TemporalType.TIMESTAMP)
-	@Column(name = "START_DATE", nullable = false, length = 23)
-	public Date getStartDate() {
-		return this.startDate;
-	}
-
-	public void setStartDate(Date startDate) {
-		this.startDate = startDate;
-	}
-
-	@Temporal(TemporalType.TIMESTAMP)
-	@Column(name = "END_DATE", length = 23)
-	public Date getEndDate() {
-		return this.endDate;
-	}
-
-	public void setEndDate(Date endDate) {
-		this.endDate = endDate;
-	}
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/entity/MonthDefinitionEnum.java

-package pl.grzejszczak.marcin.entity;
-
-public enum MonthDefinitionEnum {
-	JANUARY(0);
-
-	private int month;
-
-	private MonthDefinitionEnum(int number) {
-		month = number;
-	}
-
-	public static MonthDefinitionEnum getByKey(Integer monthId) {
-		for (MonthDefinitionEnum monthEnum : values()) {
-			if (monthEnum.month == monthId) {
-				return monthEnum;
-			}
-		}
-		return null;
-	}
-
-}

Spring JMS/src/main/pl/grzejszczak/marcin/entity/MonthRecursiveAbsence.java

-package pl.grzejszczak.marcin.entity;