Search in sources :

Example 1 with IgniteQueueEndpoint

use of org.apache.camel.component.ignite.queue.IgniteQueueEndpoint in project camel by apache.

the class IgniteComponent method createEndpoint.

@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
    ObjectHelper.notNull(getCamelContext(), "Camel Context");
    AbstractIgniteEndpoint answer = null;
    URI remainingUri = new URI(URISupport.normalizeUri(remaining));
    String scheme = remainingUri.getScheme();
    switch(scheme) {
        case "cache":
            answer = new IgniteCacheEndpoint(uri, remainingUri, parameters, this);
            break;
        case "compute":
            answer = new IgniteComputeEndpoint(uri, remainingUri, parameters, this);
            break;
        case "messaging":
            answer = new IgniteMessagingEndpoint(uri, remainingUri, parameters, this);
            break;
        case "events":
            answer = new IgniteEventsEndpoint(uri, remainingUri, parameters, this);
            break;
        case "set":
            answer = new IgniteSetEndpoint(uri, remainingUri, parameters, this);
            break;
        case "idgen":
            answer = new IgniteIdGenEndpoint(uri, remainingUri, parameters, this);
            break;
        case "queue":
            answer = new IgniteQueueEndpoint(uri, remainingUri, parameters, this);
            break;
        default:
            throw new MalformedURLException("An invalid Ignite endpoint URI was provided. Please check that " + "it starts with:" + " ignite:[cache/compute/messaging/...]:...");
    }
    setProperties(answer, parameters);
    return answer;
}
Also used : IgniteComputeEndpoint(org.apache.camel.component.ignite.compute.IgniteComputeEndpoint) MalformedURLException(java.net.MalformedURLException) IgniteMessagingEndpoint(org.apache.camel.component.ignite.messaging.IgniteMessagingEndpoint) IgniteQueueEndpoint(org.apache.camel.component.ignite.queue.IgniteQueueEndpoint) IgniteCacheEndpoint(org.apache.camel.component.ignite.cache.IgniteCacheEndpoint) IgniteSetEndpoint(org.apache.camel.component.ignite.set.IgniteSetEndpoint) IgniteIdGenEndpoint(org.apache.camel.component.ignite.idgen.IgniteIdGenEndpoint) URI(java.net.URI) IgniteEventsEndpoint(org.apache.camel.component.ignite.events.IgniteEventsEndpoint)

Example 2 with IgniteQueueEndpoint

use of org.apache.camel.component.ignite.queue.IgniteQueueEndpoint in project camel by apache.

the class IgniteQueueTest method testWithConfiguration.

@Test
public void testWithConfiguration() {
    CollectionConfiguration configuration = new CollectionConfiguration();
    configuration.setCacheMode(CacheMode.LOCAL);
    context.getRegistry(JndiRegistry.class).bind("config", configuration);
    IgniteQueueEndpoint igniteEndpoint = context.getEndpoint("ignite:queue:abc?operation=ADD&configuration=#config", IgniteQueueEndpoint.class);
    template.requestBody(igniteEndpoint, "hello");
    assert_().that(ignite().queue("abc", 0, configuration).size()).isEqualTo(1);
    assert_().that(igniteEndpoint.getConfiguration()).isEqualTo(configuration);
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) IgniteQueueEndpoint(org.apache.camel.component.ignite.queue.IgniteQueueEndpoint) CollectionConfiguration(org.apache.ignite.configuration.CollectionConfiguration) Test(org.junit.Test)

Aggregations

IgniteQueueEndpoint (org.apache.camel.component.ignite.queue.IgniteQueueEndpoint)2 MalformedURLException (java.net.MalformedURLException)1 URI (java.net.URI)1 IgniteCacheEndpoint (org.apache.camel.component.ignite.cache.IgniteCacheEndpoint)1 IgniteComputeEndpoint (org.apache.camel.component.ignite.compute.IgniteComputeEndpoint)1 IgniteEventsEndpoint (org.apache.camel.component.ignite.events.IgniteEventsEndpoint)1 IgniteIdGenEndpoint (org.apache.camel.component.ignite.idgen.IgniteIdGenEndpoint)1 IgniteMessagingEndpoint (org.apache.camel.component.ignite.messaging.IgniteMessagingEndpoint)1 IgniteSetEndpoint (org.apache.camel.component.ignite.set.IgniteSetEndpoint)1 JndiRegistry (org.apache.camel.impl.JndiRegistry)1 CollectionConfiguration (org.apache.ignite.configuration.CollectionConfiguration)1 Test (org.junit.Test)1