[ 
https://issues.apache.org/jira/browse/IGNITE-1790?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14989610#comment-14989610
 ] 

Denis Magda commented on IGNITE-1790:
-------------------------------------

Raul, thanks for taking care of this!

Please take into account these minor comments:

1) This check is redundant because this situation is validated in the 
corresponding setters in StreamAdapter.
{{A.ensure(getSingleTupleExtractor() == null || getMultipleTupleExtractor() == 
null,"cannot provide both single and multiple tuple extractor");}}

2) {{A.notNullOrEmpty(endpointUri, "endpoint URI must be provided");}}
According to the contract of {{IllegalArgumentException}} this exception is 
thrown only when an invalid argument is passed into the function. You don't 
pass {{endpointUri}} to {{start}} method that's why you shouldn't throw this 
exception from this point of execution.
My suggestion is to use {{org.apache.ignite.IgniteIllegalStateException}}. See 
how it's used in {{Ignite.ignite()}} method description.

3) {{A.ensure(!(getSingleTupleExtractor() == null && 
getMultipleTupleExtractor() == null), "tuple extractor missing");}}
The same note regarding {{IllegalArgumentException}} as above. In addition I 
see that this situation is validate in every streamer. Doesn't it make sense to 
add {{start}} method to {{StreamAdapter}} and perform there basic checks that 
are the same for every streamer?

4) Let's imagine that you successfully created an endpoint and consumer by the 
following calls:
{noformat}
        // Instantiate the Camel endpoint.
        try {
            endpoint = CamelContextHelper.getMandatoryEndpoint(camelCtx, 
endpointUri);
        }
        catch (NoSuchEndpointException e) {
            U.error(log, e);

            throw new IgniteException("Failed to start Camel streamer [errMsg=" 
+ e.getMessage() + ']');
        }

        // Create the Camel consumer.
        try {
            consumer = endpoint.createConsumer(this);
        }
        catch (Exception e) {
            U.error(log, e);

            throw new IgniteException("Failed to start Camel streamer [errMsg=" 
+ e.getMessage() + ']');
        }
{noformat}

Then you failed to start the service by some reason 
{{ServiceHelper.startServices(camelCtx, endpoint, consumer);}}.

Don't you need to release the endpoint and consumer created before?


Some comments on tests:

1) IgniteCamelStreamerTest
Is there any reason you have "@After" and "@Before" annotations there? I 
haven't seen this annotations in other Ignite test suites.

2) IgniteCamelStreamerTestSuite
Please implement the test suite in the same way the other are implemented. You 
can refer to {{IgniteCacheTestSuite}}.  


Raul, I've fixed some variable names and other stuff according to Ignite 
guidelines. The fixes are pushed onto the branch. Hope that you don't mind 
regarding this.

> Implement an Apache Camel Data Streamer
> ---------------------------------------
>
>                 Key: IGNITE-1790
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1790
>             Project: Ignite
>          Issue Type: New Feature
>          Components: streaming
>            Reporter: Raúl Kripalani
>            Assignee: Denis Magda
>             Fix For: 1.5
>
>
> An Apache Camel data streamer would make it possible for a user to use any of 
> Camel's [150+ adapters/components|http://camel.apache.org/components.html] to 
> consume data from the outside world and feed it into an Ignite cache.
> SOAP, REST, HTTP, WebSockets, FTP, File, XMPP, SMPP, POP3, IMAP, TCP, etc.
> This data streamer will instantiate a Camel consumer endpoint, it'll apply 
> the user-specified StreamTransformer to the incoming Exchange and it'll add 
> the result to the data streamer.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to