Spring Book – Chapter 20 – Spring Integration

Twitter

Spring Integration provides support for interacting with Twitter. With the Twitter adapters, you can both receive and send Twitter messages.

Twitter is a social networking and micro-blogging service that enables its users to send and read messages known as tweets. Tweets are text-based posts of up to 140 characters displayed on the author’s profile page and delivered to the author’s subscribers who are known as followers.

Listing 22-67. Maven dependency required

Listing 22-68 below shows configuration of main Spring Integration namespace and twitter related namespace in the Spring configuration file (twitter-integration-context.xml).

Listing 22-68. Spring Integration Namespace declaration

For configuring twitter inbound and outbound channel adapter, we need to have TwitterTemplate bean configured as bean in the Spring configuration file as shown in Listing 22-69 below.

Listing 22-69. Configuring twitter template using constructor arguments

TwitterTemplate can also be configured in another way as shown in Listing 22-70 below in which property loader is used to load the various twitter properties from twitter.properties file shown in Listing 22-71 below.

Listing 22-70. Configuring twitter template using twitter.properties file

Listing 22-71. Twitter.properties file in which twitter based properties are configured

Listing 22-72 below shows configuring twitter outbound channel adapter in Spring configuration file.

Listing 22-72. Configuring twitter outbound channel adapter in Spring configuration file

Listing 22-73 below shows configuring twitter inbound channel adapter in Spring configuration file.

Listing 22-73. Configuring twitter inbound channel adapter in Spring configuration file

Page Visitors: 13340

The following two tabs change content below.
Tomcy John

Tomcy John

Blogger & Author at javacodebook
He is an Enterprise Java Specialist holding a degree in Engineering (B-Tech) with over 10 years of experience in several industries. He's currently working as Principal Architect at Emirates Group IT since 2005. Prior to this he has worked with Oracle Corporation and Ernst & Young. His main specialization is on various web technologies and acts as chief mentor and Architect to facilitate incorporating Spring as Corporate Standard in the organization.
Tomcy John

Latest posts by Tomcy John (see all)

2 thoughts on “Spring Book – Chapter 20 – Spring Integration

  1. Hi,
    Thanks for this blog and information sharing!
    I have one question from Spring Integration. Just thought of checking with you.
    I have SimplewebserviceOutBoundGateway. I need to send a document / attachment to the webservice. How will i achieve that?
    This is my current gateway configuration:

    Please let me know, if you can throw some light in this area.
    Thanks in Advance!

  2. Hi,
    Thank you for your information sharing.
    I have one doubt,could you please suggest me the correct frameworks to address that issue.

    My requirement is I would like to get and process files using spring and camel.

    Thanks,
    Madhu

Leave a Reply

Your email address will not be published. Required fields are marked *