syndesisio / connectors

Apache Camel Connectors for Syndesis
Apache License 2.0
6 stars 12 forks source link

Allow a connector to be scheduled #32

Closed davsclaus closed 7 years ago

davsclaus commented 7 years ago

The trade example need to use the timer scheduler to start the route.

We should allow to make a connector be scheduled and then do a producer call, so the trade example can start from the buy-recommendation

davsclaus commented 7 years ago

See ticket: https://issues.apache.org/jira/browse/CAMEL-11126

davsclaus commented 7 years ago

Oh nice found a little bug in camel-core: https://issues.apache.org/jira/browse/CAMEL-11131

davsclaus commented 7 years ago

Okay got a working prototype, I need to polish up and make the code nicer in a few spots.

@kcbabo @chirino should a connector either always be scheduled like this, or should the citizen user be able to choose (maybe indirectly without knowing).

So I have this as a before example, notice how it uses the from timer

        from("timer:store?period=5000")
            .to("petstore?operationId=getInventory")
            .log("Pets in the store ${body}");

And now you can just do

        from("petstore?operationId=getInventory&period=2000")
            .log("Pets in the store ${body}");

And there is a default delay of 5000 so, you can do

        from("petstore?operationId=getInventory")
            .log("Pets in the store ${body}");

At this point the petstore connector is now forced into be a "from" only, but despite under the hood its actually a camel "to" but with a timer in from of it, eg from timer -> to petstore.

So in the ipaas it could be dual and made possible to use as a to endpoint as well. For example an pseudo example:

    from("trade-insight:bestPetsToBuy")
      .to("petstore?operationId=getPetsByIds")
      .log("Bye these pets ${body}")
davsclaus commented 7 years ago

Okay CAMEL-11192 merged upstream, which means we need a new Fuse Camel EA build to include this for the connectors to use.

jimmidyson commented 7 years ago

FYI - EA build triggered at https://fusesource-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/view/JBoss%20Fuse%207.0/job/fuse-eap-7.0-release-pipeline/63/console

davsclaus commented 7 years ago

@jimmidyson ah just found a little bug in camel-core which we need to get fixed as needed by the trade-insight connector in binding mode. Can you cancel the build, and kick a new when I comment here again?

jimmidyson commented 7 years ago

@davsclaus Cancelled. Let me know when you need a new one kicking. We should automate this...

davsclaus commented 7 years ago

The bug/issue which we need: https://issues.apache.org/jira/browse/CAMEL-11133

davsclaus commented 7 years ago

Okay pushed fix for Camel upstream. Not sure how fast fuse-camel sync from ASF.

And there is a PR here how to use the new schedule based as connector https://github.com/redhat-ipaas/connectors/pull/33

That is using 2.19.0-SNAPSHOT until we got that EA build.

The last commit you MUST ensure is in the EA is https://github.com/apache/camel/commit/95314057cf103039c0b44dbf2644ab06ea05d3f5

davsclaus commented 7 years ago

Ah the jboss fuse camel need to sync more commits, its not up to date https://github.com/jboss-fuse/camel/commits/master

davsclaus commented 7 years ago

Its up to date now

kcbabo commented 7 years ago

Thanks, Claus! I think this is consistent with the spirit of what we want - basically treating a polling connector as a single thing vs. multiple things (timer connector + endpoint connector).