Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.jboss.soa.esb.actions;
- import org.jboss.soa.esb.helpers.ConfigTree;
- import org.jboss.soa.esb.message.Message;
- import twitter4j.Twitter;
- public class TwitterAdapter extends AbstractActionPipelineProcessor {
- private String userName;
- private String password;
- public TwitterAdapter(ConfigTree configTree) {
- userName = configTree.getAttribute("user-name");
- password = configTree.getAttribute("password");
- }
- public Message process(Message message) throws ActionProcessingException {
- Twitter twitter = null;
- String status = null;
- try {
- status = (String) message.getBody().get();
- twitter = new Twitter(userName, password);
- twitter.updateStatus(status);
- } catch (Exception ex) {
- throw new ActionProcessingException(ex);
- }
- return message;
- }
- }
Add Comment
Please, Sign In to add comment