.build(); client.connect(); running = true;
client.connect();
@Override public void open() throws TexeraException { if (cursor != CLOSED) { return; } try { twitterConnector.getClient().connect(); cursor = OPENED; } catch (Exception e) { throw new DataflowException(e.getMessage(), e); } }
.build(); client.connect(); running = true;
@Before public void setUp() throws Exception { String dummyKeyword = "is"; List<String> keyWordList = new ArrayList<>(Arrays.asList(dummyKeyword)); twitterConnector = new TwitterConnector(keyWordList, null, null, null, null, null, null); twitterConnector.getClient().connect(); }
@Override protected void init(@Nonnull Context context) { StatusesFilterEndpoint endpoint = new StatusesFilterEndpoint(); endpoint.trackTerms(terms); String consumerKey = properties.getProperty("consumerKey"); String consumerSecret = properties.getProperty("consumerSecret"); String token = properties.getProperty("token"); String tokenSecret = properties.getProperty("tokenSecret"); if (isMissing(consumerKey) || isMissing(consumerSecret) || isMissing(token) || isMissing(tokenSecret)) { throw new IllegalArgumentException("Twitter credentials are missing!"); } Authentication auth = new OAuth1(consumerKey, consumerSecret, token, tokenSecret); client = new ClientBuilder() .hosts(Constants.STREAM_HOST) .endpoint(endpoint) .authentication(auth) .processor(new StringDelimitedProcessor(queue)) .build(); client.connect(); }
TwitterSource(Properties properties, List<String> terms) { StatusesFilterEndpoint endpoint = new StatusesFilterEndpoint().trackTerms(terms); String consumerKey = properties.getProperty("consumerKey"); String consumerSecret = properties.getProperty("consumerSecret"); String token = properties.getProperty("token"); String tokenSecret = properties.getProperty("tokenSecret"); if (isMissing(consumerKey) || isMissing(consumerSecret) || isMissing(token) || isMissing(tokenSecret)) { throw new IllegalArgumentException("Twitter credentials are missing!"); } Authentication auth = new OAuth1(consumerKey, consumerSecret, token, tokenSecret); client = new ClientBuilder() .hosts(Constants.STREAM_HOST) .endpoint(endpoint) .authentication(auth) .processor(new StringDelimitedProcessor(queue)) .build(); client.connect(); }
client.connect(); LOG.info("Twitter Streaming API connection established successfully");