You have to use only one URI in the Ignite .to and define the headers you'll 
need in a processor between from and to.

from("mqtt:bar?subscribeTopicName=test&host=tcp://localhost:1883").process(new 
Processor() {
    @Override
    public void process(Exchange exchange) throws Exception {
        exchange.getIn().setHeader(IgniteConstants.IGNITE_CACHE_KEY, "abcd");
    }
})

.to("ignite-cache:cache:myCacheName?operation=PUT");


What you were trying to do is using a component with URI 1234, one with URI 
IgniteConstants.IGNITE_CACHE_KEY and one with URI abcd.
Andrea Cosentino 
----------------------------------
Apache Camel PMC Member
Apache Karaf Committer
Apache Servicemix PMC Member
Email: [email protected]
Twitter: @oscerd2
Github: oscerd


On Wednesday, May 31, 2017 3:15 PM, solomon <[email protected]> wrote:



Hi,


I am trying to read the data from Camel-MQTT and PUT the message into

Camel-Ignite' cache within camel context.


I am getting error while doing so...  searched online for examples for

Camel-Ignite component, but I didn't get any examples.


Camel version I'm using is 2.17.2


My code is like this :


private static final String HOST = "localhost:47500..47509";

    

    public static void main(String[] args) throws Exception {

        

        CamelContext context = new DefaultCamelContext();  

        

        TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();

        ipFinder.setAddresses(Collections.singletonList(HOST));

               TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();

        discoSpi.setIpFinder(ipFinder);

          

        IgniteConfiguration cfg1 = new IgniteConfiguration();

        cfg1.setDiscoverySpi(discoSpi);

        cfg1.setPeerClassLoadingEnabled(false);

        

        CacheConfiguration cacheCfg = new CacheConfiguration<String, String>();

        cacheCfg.setName("myCacheName");

        cacheCfg.setCacheMode(CacheMode.PARTITIONED);

        cfg1.setCacheConfiguration(cacheCfg);

          

        IgniteComponent igniteComponent=new IgniteComponent();

          

        context.addComponent(getScheme(),

IgniteComponent.fromConfiguration(cfg1));

        try {

            context.addRoutes(new RouteBuilder() {  

                @Override

                public void configure() throws Exception {

                  

from("mqtt:bar?subscribeTopicName=test&host=tcp://localhost:1883")

                    .to("ignite-cache:cache:myCacheName?operation=PUT", "1234",

IgniteConstants.IGNITE_CACHE_KEY, "abcd");

                }

            });

        } catch (Exception e) {

            e.printStackTrace();

        }

        

        context.start();


        // let it run for 5 minutes before shutting down

        Thread.sleep(5 * 60 * 1000);

    }

    

        private static String getScheme() {

            return "ignite-cache";

      }


Error : 


Exception in thread "main" org.apache.camel.FailedToCreateRouteException:

Failed to create route route1 at: >>> To[1234] <<< in route:

Route(route1)[[From[mqtt:bar?subscribeTopicName=test&host=tc... because of

No endpoint could be found for: 1234, please check your classpath contains

the needed Camel component jar.

    at

org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1072)

    at

org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:196)

    at

org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:974)

    at

org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3301)

    at

org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3024)

    at

org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)

    at

org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2854)

    at

org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2850)

    at

org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2873)

    at

org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2850)

    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)

    at

org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2819)

    at com.tg.camelTest.CamelIgnite.main(CamelIgnite.java:81)

Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be

found for: 1234, please check your classpath contains the needed Camel

component jar.

    at

org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:81)

    at

org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:211)

    at

org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:107)

    at

org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:113)

    at

org.apache.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:62)

    at

org.apache.camel.model.SendDefinition.createProcessor(SendDefinition.java:56)

    at

org.apache.camel.model.ProcessorDefinition.makeProcessorImpl(ProcessorDefinition.java:534)

    at

org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:495)

    at

org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:219)

    at

org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:1069)

    ... 12 more

  


Can you please tell me what am I doing wrong to solve this issue.


Thanks




--

View this message in context: 
http://camel.465427.n5.nabble.com/Need-help-on-Camel-Ignite-Coomponent-tp5801433.html

Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to