5 Replies Latest reply on Jul 10, 2013 7:55 PM by Kris Verlaenen

    Where can we find TwitterWorkItemHandler?

    Prasanth Manchambhatla Newbie

      Where can we see the source code of that class?

        • 2. Re: Where can we find TwitterWorkItemHandler?
          Tihomir Surdilovic Master

          You can get the jar file from the repository here: people.redhat.com/kverlaen/repository/Twitter/lib/jbpm-twitter.jar.

          It includes the sources of the handler.

          • 3. Re: Where can we find TwitterWorkItemHandler?
            Jose Cavieres Newbie


            The source code is not available in the jar file jbpm-twitter.jar, only the class files.

            I've searched for it everywhere and it's not available.

            Can you please post the sources or fix the jar file?


            Thanks in advance

            • 4. Re: Where can we find TwitterWorkItemHandler?
              Jose Cavieres Newbie

              By the way, the twitter service in the repository is based in the Twitter API v1, which was switched off last month by Twitter,

              so the service has to be rebuilt against the 3.0.x version of Twitter4J in order to be "v1.1 compatible".

              But the source code for this twitter-jbpm service is not available, so this upgrade is impossible for now.

              Please release the source code.

              • 5. Re: Where can we find TwitterWorkItemHandler?
                Kris Verlaenen Master



                You are correct.  I just tested and updating twitter4j to version 3.0.3 seems to work well.





                * Copyright 2010 JBoss Inc


                * Licensed under the Apache License, Version 2.0 (the "License");

                * you may not use this file except in compliance with the License.

                * You may obtain a copy of the License at


                *      http://www.apache.org/licenses/LICENSE-2.0


                * Unless required by applicable law or agreed to in writing, software

                * distributed under the License is distributed on an "AS IS" BASIS,

                * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

                * See the License for the specific language governing permissions and

                * limitations under the License.



                package org.jbpm.process.workitem.twitter;


                import java.util.Properties;


                import org.kie.api.runtime.process.WorkItem;

                import org.kie.api.runtime.process.WorkItemHandler;

                import org.kie.api.runtime.process.WorkItemManager;


                import twitter4j.Twitter;

                import twitter4j.TwitterFactory;

                import twitter4j.conf.ConfigurationBuilder;


                public class TwitterWorkItemHandler implements WorkItemHandler {


                    private Twitter twitter;


                    public void setCredentials(String consumerKey, String consumerSecret, String accessKey, String accessSecret) {

                        ConfigurationBuilder configBuilder = new ConfigurationBuilder();







                        twitter = new TwitterFactory(configBuilder.build()).getInstance();



                    public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {

                        try {

                            if (twitter == null) {



                            String message = (String)workItem.getParameter("Message");

                            if (message != null && message.trim().length() > 0) {




                        catch(Throwable t) {




                        manager.completeWorkItem(workItem.getId(), null);



                    private void initTwitter() throws Exception {

                        Properties p = new Properties();









                    public void abortWorkItem(WorkItem workitem, WorkItemManager workitemmanager) {