Search in sources :

Example 1 with AtmosScheduledPollGetConsumer

use of org.apache.camel.component.atmos.integration.consumer.AtmosScheduledPollGetConsumer in project camel by apache.

the class AtmosEndpoint method createConsumer.

/**
     * Create one of the camel consumer available based on the configuration
     *
     * @param processor the given processor
     * @return the camel consumer
     * @throws Exception
     */
public Consumer createConsumer(Processor processor) throws Exception {
    LOG.debug("resolve consumer atmos endpoint {" + configuration.getOperation().toString() + "}");
    LOG.debug("resolve consumer atmos attached client:" + configuration.getClient());
    AtmosScheduledPollConsumer consumer;
    if (this.configuration.getOperation() == AtmosOperation.get) {
        consumer = new AtmosScheduledPollGetConsumer(this, processor, configuration);
        consumer.setDelay(POLL_CONSUMER_DELAY);
        return consumer;
    } else {
        throw new AtmosException("operation specified is not valid for consumer!");
    }
}
Also used : AtmosScheduledPollGetConsumer(org.apache.camel.component.atmos.integration.consumer.AtmosScheduledPollGetConsumer) AtmosScheduledPollConsumer(org.apache.camel.component.atmos.integration.consumer.AtmosScheduledPollConsumer) AtmosException(org.apache.camel.component.atmos.util.AtmosException)

Example 2 with AtmosScheduledPollGetConsumer

use of org.apache.camel.component.atmos.integration.consumer.AtmosScheduledPollGetConsumer in project camel by apache.

the class AtmosConsumerTest method shouldCreateGetConsumer.

@Test
public void shouldCreateGetConsumer() throws Exception {
    // Given
    AtmosEndpoint atmosEndpoint = context.getEndpoint("atmos:foo/get?remotePath=/path", AtmosEndpoint.class);
    // When
    Consumer consumer = atmosEndpoint.createConsumer(null);
    // Then
    Assert.assertTrue(consumer instanceof AtmosScheduledPollGetConsumer);
    assertEquals("foo", atmosEndpoint.getConfiguration().getName());
}
Also used : AtmosScheduledPollGetConsumer(org.apache.camel.component.atmos.integration.consumer.AtmosScheduledPollGetConsumer) Consumer(org.apache.camel.Consumer) AtmosScheduledPollGetConsumer(org.apache.camel.component.atmos.integration.consumer.AtmosScheduledPollGetConsumer) Test(org.junit.Test)

Aggregations

AtmosScheduledPollGetConsumer (org.apache.camel.component.atmos.integration.consumer.AtmosScheduledPollGetConsumer)2 Consumer (org.apache.camel.Consumer)1 AtmosScheduledPollConsumer (org.apache.camel.component.atmos.integration.consumer.AtmosScheduledPollConsumer)1 AtmosException (org.apache.camel.component.atmos.util.AtmosException)1 Test (org.junit.Test)1