Giter Site home page Giter Site logo

ml-camel-client's Introduction

This project is a simple example of ml-camel-mlcp, a Camel component for invoking MarkLogic Content Pump. This project shows you how to setup a "hot folder" such that any time a file is copied into a certain directory, it is automatically ingested into MarkLogic via Camel and Content Pump. And you can reuse all Content Pump import arguments while doing so.

How do I use this?

Just do the following:

  1. Clone this repository
  2. Run "./gradlew mlDeploy camelRun"
  3. Make sure "gradlew" is executable
  4. If you're on Windows, run "gradlew mlDeploy camelRun" instead
  5. If you have Gradle available on your path already, just run "gradle". "gradlew" is included to minimize the setup necessary.

The first Gradle task - mlDeploy - uses ml-gradle to create a new MarkLogic application with a REST API server on port 8310 and an XDBC server on port 8311 (feel free to change these ports, they're specified in the gradle.properties file). The XDBC server will be used by Content Pump, and you can use the REST API server to browse/search documents, along with all the other nice out-of-the-box operations you get with a MarkLogic REST API server.

The second task - camelRun - fires up Camel. By default, Camel will watch a directory named "inbox" within the directory where you cloned this repository. When you a copy/move a file into that directory, Camel will read it in and then pass it off to Content Pump, which will ingest it into MarkLogic. You'll see plenty of logging in the console window from which you ran the Gradle tasks.

To check your results as you ingest files, either use qconsole or try your application's REST API search endpoint.

How can I customize this?

Just edit the gradle.properties file:

  • fileUri is the URI for the Camel File component. You can change this to be whatever path you would like.
  • mlcpUri is the URI for the Camel MarkLogic component. You can attach any of the Content Pump import arguments onto the querystring. For reference, the default value of mlcpUri specifies a collection to place each ingested document into.

Cool - how can I use this in my existing application?

Easy - you'll notice there's no real source code in this project - there are just some small config files. The build.gradle file shows you how to declare a dependency on ml-camel-mclp. Once you've done that - and you can do that using Maven/Gradle/whatever - it's simply a matter of how you choose to configure Camel. This project uses a Camel XML file to specify routes and a Spring file to use Spring for running Camel - those config files are under src/main/resources. But it's up to you how you want to configure Camel, and it's best to consult the Camel docs for all the different options that you have.

ml-camel-client's People

Contributors

luiz-n avatar rjrudin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

luiz-n

ml-camel-client's Issues

complete camelRun task

@rjrudin This works great for using gradle to start up a camel route! My only issue is finding a way to "end" the task and then do other tasks once i'm done with camel. I've figured out a way to shut down the CamelContext when the hot folder is empty but the task seems to simply hang after Camel shuts down. Any clue on what might be causing the task to not complete?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.