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

Steve Blackmon commented on STREAMS-411:
----------------------------------------

Here's an example of a main method appropriate for 
org.apache.streams.twitter.provider.TwitterTimelineProvider

    public static void main(String[] args) {
        TwitterUserInformationConfiguration config = new 
ComponentConfigurator(TwitterUserInformationConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig())
        TwitterTimelineProvider provider = new TwitterTimelineProvider(config);
        provider.prepare(config);
        provider.startStream();
        do {
            Iterator<StreamsDatum> iterator = 
provider.getProviderQueue().iterator();
            while(iterator.hasNext()) {
                StreamsDatum datum = iterator.next();
                String json;
                try {
                    json = MAPPER.writeValueAsString(datum.getDocument());
                    System.out.println(json);
                } catch (JsonProcessingException e) {
                    System.err.println(e.getMessage());
                }
            }
        } while( provider.isRunning());
    }

> ability (and instructions on how) to run providers directly from console
> ------------------------------------------------------------------------
>
>                 Key: STREAMS-411
>                 URL: https://issues.apache.org/jira/browse/STREAMS-411
>             Project: Streams
>          Issue Type: Improvement
>            Reporter: Steve Blackmon
>             Fix For: 0.4
>
>
> All of the providers currently require attachment to a run-time to use.
> If providers could be configured and executed directly from the console, they 
> would become more valuable for casual use cases where users just want to 
> easily grab documents without writing or deploying custom code.
> This would probably take the form of adding a main method and perhaps a 
> Runnable trait to each provider, that when launched resolves the appropriate 
> typesafe config, starts up the provider, and pulls documents out of the 
> outbound queue and writes them to STDOUT as long as the streams is running.
> Instructions how to do this should also be added to the javadocs of the 
> providers and/or the markdowns of each module.



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

Reply via email to