List of usage examples for twitter4j UserStreamAdapter UserStreamAdapter
UserStreamAdapter
From source file:net.nokok.twitduke.core.twitter.LambdaTwitterStream.java
License:Open Source License
public void onUserListMemberDeletion(Event3<User, User, UserList> arg) { this.twitterStream.addListener(new UserStreamAdapter() { @Override/*from w w w . j a v a 2 s . c om*/ public void onUserListMemberDeletion(User deletedMember, User listOwner, UserList list) { arg.onEvent(deletedMember, listOwner, list); } }); }
From source file:net.nokok.twitduke.core.twitter.LambdaTwitterStream.java
License:Open Source License
public void onUserListSubscription(Event3<User, User, UserList> arg) { this.twitterStream.addListener(new UserStreamAdapter() { @Override/*w ww . j a v a 2 s. co m*/ public void onUserListSubscription(User subscriber, User listOwner, UserList list) { arg.onEvent(subscriber, listOwner, list); } }); }
From source file:net.nokok.twitduke.core.twitter.LambdaTwitterStream.java
License:Open Source License
public void onUserListUnsubscription(Event3<User, User, UserList> arg) { this.twitterStream.addListener(new UserStreamAdapter() { @Override/*from ww w . j ava2s .co m*/ public void onUserListUnsubscription(User subscriber, User listOwner, UserList list) { arg.onEvent(subscriber, listOwner, list); } }); }
From source file:net.nokok.twitduke.core.twitter.LambdaTwitterStream.java
License:Open Source License
public void onUserListCreation(Event2<User, UserList> arg) { this.twitterStream.addListener(new UserStreamAdapter() { @Override/* w w w. j a va 2s. com*/ public void onUserListCreation(User listOwner, UserList list) { arg.onEvent(listOwner, list); } }); }
From source file:net.nokok.twitduke.core.twitter.LambdaTwitterStream.java
License:Open Source License
public void onUserListUpdate(Event2<User, UserList> arg) { this.twitterStream.addListener(new UserStreamAdapter() { @Override/*from w w w .j a va 2 s . co m*/ public void onUserListUpdate(User listOwner, UserList list) { arg.onEvent(listOwner, list); } }); }
From source file:net.nokok.twitduke.core.twitter.LambdaTwitterStream.java
License:Open Source License
public void onUserProfileUpdate(Event<User> arg) { this.twitterStream.addListener(new UserStreamAdapter() { @Override/*from w w w . j a va 2 s . co m*/ public void onUserProfileUpdate(User updatedUser) { arg.onEvent(updatedUser); } }); }
From source file:org.mule.twitter.TwitterConnector.java
License:Open Source License
/** * Retrieves the following user updates notifications:<br/> * - New Statuses <br/>// w w w .j av a 2 s. com * - Block/Unblock events <br/> * - Follow events <br/> * - User profile updates <br/> * - Retweets <br/> * - List creation/deletion <br/> * - List member addition/remotion <br/> * - List subscription/unsubscription <br/> * - List updates <br/> * - Profile updates <br/> * <p/> * Such notifications are represented as org.mule.twitter.UserEvent objects * <p/> * Only one Twitter stream can be consumed using the same credentials. As a consequence, * only one twitter stream can be consumed per connector instance. * <p/> * {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:userStream} * * @param keywords the keywords to track for new statuses * @param callback_ the {@link SourceCallback} used to dispatch messages when a response is received */ @Source public void userStream(@Placement(group = "Keywords to Track") List<String> keywords, final SourceCallback callback_) { initStream(); final SoftCallback callback = new SoftCallback(callback_); stream.addListener(new UserStreamAdapter() { @Override public void onException(Exception ex) { logger.warn("An exception occured while processing user stream", ex); } @Override public void onStatus(Status status) { try { callback.process(UserEvent.fromPayload(EventType.NEW_STATUS, status.getUser(), status)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onBlock(User source, User blockedUser) { try { callback.process(UserEvent.fromTarget(EventType.BLOCK, source, blockedUser)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onFollow(User source, User followedUser) { try { callback.process(UserEvent.fromTarget(EventType.FOLLOW, source, followedUser)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onUnblock(User source, User unblockedUser) { try { callback.process(UserEvent.fromTarget(EventType.UNBLOCK, source, unblockedUser)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onUserListCreation(User listOwner, UserList list) { try { callback.process(UserEvent.fromPayload(EventType.LIST_CREATION, listOwner, list)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onUserListDeletion(User listOwner, UserList list) { try { callback.process(UserEvent.fromPayload(EventType.LIST_DELETION, listOwner, list)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onUserListMemberAddition(User addedMember, User listOwner, UserList list) { try { callback.process(UserEvent.from(EventType.LIST_MEMBER_ADDITION, addedMember, listOwner, list)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onUserListMemberDeletion(User deletedMember, User listOwner, UserList list) { try { callback.process( UserEvent.from(EventType.LIST_MEMBER_DELETION, deletedMember, listOwner, list)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onUserListSubscription(User subscriber, User listOwner, UserList list) { try { callback.process(UserEvent.from(EventType.LIST_SUBSCRIPTION, subscriber, listOwner, list)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onUserListUnsubscription(User subscriber, User listOwner, UserList list) { try { callback.process(UserEvent.from(EventType.LIST_UNSUBSCRIPTION, subscriber, listOwner, list)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onUserListUpdate(User listOwner, UserList list) { try { callback.process(UserEvent.fromPayload(EventType.LIST_UPDATE, listOwner, list)); } catch (Exception e) { logger.error(e.getMessage(), e); } } @Override public void onUserProfileUpdate(User updatedUser) { try { callback.process(UserEvent.fromPayload(EventType.PROFILE_UPDATE, updatedUser, null)); } catch (Exception e) { logger.error(e.getMessage(), e); } } }); stream.user(toStringArray(keywords)); }