Groovy script with Camel integration ..

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Groovy script with Camel integration ..

ARUN_1208
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Groovy script with Camel integration ..

GregChapman
This forum is for Nabble Support only.

Did you mean to post at:
http://camel.465427.n5.nabble.com/Camel-Users-f465428.html
Volunteer Helper - but recommending that users move off the platform!
Once the admin for GregHelp now deleted.
Reply | Threaded
Open this post in threaded view
|

Re: Groovy script with Camel integration ..

ARUN_1208
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Groovy script with Camel integration ..

ARUN_1208
In reply to this post by GregChapman
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Groovy script with Camel integration ..

GregChapman
The point is that no one here will have the faintest idea what you are talking about.

You might as well be writing in Sanskrit, about extinct breeds of cat.

Nabble hosts tens of thousands of forums on different subjects. This one handles issues relating to the platform itself and nothing else.

To reach people who have an interest in your problem and the ability to answer it you need to register and post in a forum where people have an understanding of the issues you are concerned about.

Repeatedly posting on a topic that is only of interest to you may be regarded as spamming and cause you to be banned from this forum (though not Nabble as a whole).

Volunteer Helper - but recommending that users move off the platform!
Once the admin for GregHelp now deleted.
Reply | Threaded
Open this post in threaded view
|

Having problems running Groovy script with Camel application..

Kumar_Nabble
Scenario: Just wanted to transfer the files from one location to another location using camel and groovy script.
Problem:  how can we make sure script is executing. I am expecting some kind of error messages or console logs.

Sample MainApp Program :

class MainApp {
    static void main(String... args)  {
        def camelContext = new DefaultCamelContext()

        println("printing something in the console MainApp")
        camelContext.addRoutes( new RouteBuilder() {

            @Override
            void configure() {
                println("Printing some thing before queue")
                from("Test").to("Test")
                println("printing something after queue")
            }
        })
         //camelContext.start()

       // Thread.sleep(10000)
       // camelContext.stop()

    }

}



Output :

sampling ...
include patterns:

org\.apache\.camel\..*
exclude patterns:
printing something in the console MainApp
Printing some thing before the queue
printing something after queue

Process finished with exit code 0



Pom.xml file: If you could observe, below file contains all the jar files which are related to groovy and camel.. (I am thinking there are problems with pom file.. please let me know if you are finding out the same)


<?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">

    <modelVersion>4.0.0</modelVersion>


    <groupId>SampleCamelProject</groupId>
    <artifactId>camel-example-groovy</artifactId>
    <packaging>jar</packaging>
    <version>0.0.0</version>
    <name>SampleCamelProject</name>

       <properties>
        <maven-compiler-plugin-version>3.8.0</maven-compiler-plugin-version>
        <maven-resources-plugin-version>3.1.0</maven-resources-plugin-version>
        <maven-eclipse-plugin-version>2.10</maven-eclipse-plugin-version>
        <exec-maven-plugin-version>1.6.0</exec-maven-plugin-version>


        <camel-core-version>2.13.3</camel-core-version>
        <camel-groovy-dsl-version>2.19.5</camel-groovy-dsl-version>
        <camel-jetty-version>1.6.0</camel-jetty-version>
        <log4j-api-version>2.11.1</log4j-api-version>
        <log4j-core-version>2.11.1</log4j-core-version>
        <log4j-slf4j-version>2.11.1</log4j-slf4j-version>
    </properties>


    <description>A Camel route using Groovy DSL</description>



    <dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>${camel-core-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-groovy-dsl</artifactId>
            <version>${camel-groovy-dsl-version}</version>
        </dependency>

       
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-jetty</artifactId>
            <version>${camel-jetty-version}</version>
        </dependency>

       
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${log4j-api-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j-core-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j-slf4j-version}</version>
        </dependency>

    </dependencies>

    <build>
        <defaultGoal>install</defaultGoal>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin-version}</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin-version}</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                   
                   
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>2.9.2-01</version>
                        <exclusions>
                            <exclusion>
                                <groupId>org.codehaus.groovy</groupId>
                                <artifactId>groovy-eclipse-batch</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>2.4.3-01</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>${maven-eclipse-plugin-version}</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature>
                    </additionalProjectnatures>
                    <classpathContainers>
                        <classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
                        <classpathContainer>GROOVY_DSL_SUPPORT</classpathContainer>
                    </classpathContainers>
                </configuration>
            </plugin>

           
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${exec-maven-plugin-version}</version>
                <configuration>
                    <mainClass>org.apache.camel.MainAppTest</mainClass>
                    <includePluginDependencies>false</includePluginDependencies>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jdk9-build</id>
            <activation>
                <jdk>9</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                       
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-compile</id>
                                <phase>none</phase>
                            </execution>
                            <execution>
                                <id>default-testCompile</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>


Above same app I executed in java: I am getting an error(As expected)

Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route(route1)[[From[Test]] -> [To[Test]]] because of No endpoint could be found for: Test, please check your classpath contains the needed Camel component jar.

The same thing I am expecting from groovy script .. please suggest me if I am missing anything.