SlideShare a Scribd company logo
1   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Leverage Enterprise
Integration Patterns with
Apache Camel and Twitter
Bruno Borges
Oracle Product Manager for Latin America
Java EE, GlassFish, WebLogic, Coherence



2   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Who am I?
        Bruno Borges


           Java developer since 2000
           Speaker at Conferences
                    – JustJava, JavaOne Brazil, The Developers’ Conference, ApacheCon
           Evangelized Apache Camel and Apache Wicket in Brazil
           Joined Oracle on July 2012
                    – Product Manager for Java EE, GlassFish and WebLogic – Latin America
           Married, lives in Sao Paulo, has a Golden Retriever, hiker and gamer



3   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Agenda


         Enterprise Integration Patterns
         Introduction to Apache Camel
         Social Media and Social Data
         Camel Twitter
         Demonstration



4   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Enterprise
        Integration
        Patterns




5   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
“If you are involved with the operation or development of an
         enterprise application, there will doubtless come a time
         when you will need to integrate your application with another
         using the emerging preferred approach of messaging.”

           Randy Stafford
           Oracle




6   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Enterprise Integration Patterns
        Integration, integration, integration…


           Why do we need patterns for integration?
           Why is it so hard?
           Asynchronous messages
           Where and when to use them?
           Cloud Computing depends on it




7   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Apache Camel
        http://camel.apache.org




8   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What is Apache Camel?
        A Java framework that enables the developer to:


           Use implementations of Enterprise Integration Patterns
           Design routes for Enterprise Integration Patterns
           Use out-of-the-box or develop components and endpoints
           Process asynchronous and synchronous messages
           Connect distinct and independent systems
           Receive, transform and deliver data




9   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Quick overview of Apache Camel
         The core of Camel is about


            Components
            Endpoints
            Routes
            Exchanges and Messages
            Consumers
            Producers
            Processors



10   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What can you do with Apache Camel?
         Example of exchanging and filtering messages between queues




                                                                Queue A     Queue B




11   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What can you do with Apache Camel?
         Example of exchanging a message between queues




                                                                Queue A              Queue B


                                                            from                        to
                                                                            filter
                                                           queue A                   queue B

12   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What can you do with Apache Camel?
         Example of exchanging a message between queues




                                                                Queue A                Queue B



                                                     from(qA)               filter()   to(qB)


13   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Example using Spring
         Because you love XML

            <camelContext xmlns="http://camel.apache.org/schema/spring">
                <route>
                    <from uri="file:///var/usr/inbox/"/>
                    <choice>
                        <when> <xpath>$foo = 'widget'</xpath>
                               <to uri="seda:widget"/> </when>
                        <when> <xpath>$foo = 'gadget'</xpath>
                               <to uri="seda:gadget"/> </when>
                        <otherwise> <to uri="seda:lixo"/> </otherwise>
                    </choice>
                </route>
            </camelContext>




14   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Examples using Scala
         With the Scala DSL


            "direct:a" when(_.in ==
            "<hello/>") to("direct:b")

            "direct:b" ==> {
              when(_.in == "<hallo/>") {
                to ("mock:c")
              } otherwise {
                to ("mock:e")
              }
              to ("mock:d")
            }

15   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Apache Camel
         Implementation of Enterprise Integration Patterns


            DSLs for Java, Spring XML and Scala
            Standard URIs for Endpoints
            Message routing based on Predicates and Expressions
            Lots of components
                     – JMS, HTTP, MINA, JDBC, FTP, WebServices, EJB, JPA, Hibernate, IRC,
                             JCR, AS/400, LDAP, Mail, Nagios, POP, Printers, Quartz, Restlet, RMI,
                             RSS, Scalate, XMPP…
            Integrates with CDI
                     – CamelContext can be started with EJB3’s @Startup/@Singleton

16   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Social Media and
         Social Data




17   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Social Media
         The Rise of Social Media as a Communications Channels


            29% of consumers post negative comments on social networks
            49% of 16-24 y’o have posted negative comment following bad CX
            71% that had complaints on social networks were ignored


            Of 29% who did get responses, 51% had positive reaction after
            17% of those who had a response, wrote a positive comment
            13% deleted their negative post

Source: 2011 Customer Experience Index Report “The Era of Impatience”
http://www.oracle.com/us/products/applications/uk-cei-report-1641675.pdf
18   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Social Data
         Reading and processing all that data


            Twitter for instance
                     – Twitter, on average, receives 3,9k tweets per second
                     – Peaks during main events can reach 20k tweets per second
                     – This can more than 300 million tweets per day
                     – One tweet may have 140 characters
                                   560 bytes (Twitter uses UTF-8)
                     – Per day, more than 150 GB of raw text tweets
                                   Not counting indexing and storage overhead
            Let’s not forget about Facebook, Google+, LinkedIn and many others
19   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Social Data


         “It is not information overload.
           It’s filter failure”


            Clay Shirky
            Independent Consultant, Teacher and Writer




20   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Filtering and Processing Social Data
         It looks like a lot with Enterprise Integration Patterns, isn’t?


            Read status updates
            Filter based on general keywords
            Identify the issue based on their content
            Route to who will best process that tweet
            Reply if possible
            Store for future conversations with original sender
                     – Store retweets that mention users who thought the same thing
            Customize as needed

21   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Twitter
         Component for Apache Camel




22   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Twitter
         The initial idea: March 2009                                       http://blog.brunoborges.com.br/2009/03/leverage-
                                                                            eip-with-apache-camel-and.html




23   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Twitter
         The initial idea: March 2009                                       http://blog.brunoborges.com.br/2009/03/leverage-
                                                                            eip-with-apache-camel-and.html




24   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Twitter
         Proposed as a Camel Component to the ASF in 2009


            CAMEL-1520
                     – https://issues.apache.org/jira/browse/CAMEL-1520
            Presented at ApacheCon NA’09 during the BarCamp
            Discussions with Camel committers at ApacheCon led me to build a
             broader component, that could support other social networks
            Challenge: same URIs and features for different Social Networks
             (“social data providers”). Starting with Facebook, Twitter, LinkedIn,
             Foursquare, and (the already dead) Google Buzz


25   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Social
         How would it look like?


            Started in 2010
            Goal
                     – The Camel Social component objective was to be able to poll social data
                             from several networks in a uniform way to be processed through a route
            URI format
                     – social://[social provider] [/social path]?parameters
            Features
                     – Post, Read, Search


26   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Social
         Examples


            Sending a tweet
            "direct:foo" to "social://twitter/status"

            Reading a Facebook Timeline
            "social://facebook/timeline/brunocborges" ==> {
               to("log:facebookWall")
            }
            Searching for events on Facebook
             "direct:doSearch" to "social://facebook/events"
                                                                            to "log:events"


27   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Social
         An unsuccessful attempt

                                                                            http://code.google.com/p/camel-social
            Problem
                     – It was very hard to design an standard API for different Social Nets
            Died in 2010
            What about Spring Social?
                     – Didn’t exist back then
                     – Now they have an abstract API for Social Providers and for OAuth
                     – One extra API per Social Network
                     – It “could” bring the component back to life


28   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Twitter
         A rebirth, thanks to GitHub


            May 2011 – project rebooted on GitHub
                     – Focus only on Twitter
            http://github.com/brunoborges/camel-twitter
                                                                            @brettemeyer
            Kudos to Brett Meyer, who finished the job
            Bilgin Ibryam added support for the Twitter Streaming API


            Thank you guys! I owe you two a beer :-)




29   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Twitter
         Final version


            Available since Apache Camel 2.10
            Features
                     – Send a tweet (update status)
                     – Send and read Direct Messages (DMs)
                     – Search using REST (polling) or Streaming
                     – Sample streaming from public tweets
                     – Timeline reads for home, mentions, retweets, specific user
            Uses the well-know Twitter4J library (Apache licensed)


30   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Examples
         Using the Scala DSL

          Sending a tweet
          "jms:queue:tweetingQueue1" to "twitter://timeline/user"

          Reading a Timeline
          "twitter://timeline/home?type=polling&delay=5" ==> {
             to("log:homeTweets")
          }
          Searching for keywords
                  "direct:doSearch" to "twitter://search?keywords=JavaOne“
                                                                            to "log:homeTweets"



31   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Twitter Demo
         Searching for pictures about Batman




32   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Camel Twitter Demo
         How it works


            Connects to the Search Streaming channel based on keywords
            Filter for tweets with media only
            Check Coherence Cache and filter duplicates
            Put image/tweet URL as key/value on Coherence Cache
            Transform tweets into small POJOs
            Transform POJOs into JSON Strings
            Sends to users connected to the WebSocket channel

           * based on the Camelympics project developed by Bilgin Ibryam
                https://github.com/bibryam/camelympics
33   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
About Camel Coherence Component
         The #1 Distributed Caching technology


            A fork of the Camel Cache component
                     – Instead of EHCache, now uses Oracle Coherence
            Same features as the core component
                     – Operations: add, check, get, remove, removeAll
                     – URI: coherence://cacheName
            Coherence is LRU by default (‘local-scheme’)
                     – Great for the demo! Stores the recent tweets without blowing the Heap
                     – If more storage is needed, deploy new Coherence Cache instance


34   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
QUESTIONS?




35   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
THANK YOU!
         @brunoborges
         blogs.oracle.com/brunoborges




36   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
The preceding is intended to outline our general product direction. It is intended
         for information purposes only, and may not be incorporated into any contract.
         It is not a commitment to deliver any material, code, or functionality, and should
         not be relied upon in making purchasing decisions. The development, release,
         and timing of any features or functionality described for Oracle’s products
         remains at the sole discretion of Oracle.




37   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
38   Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

More Related Content

What's hot (20)

PDF
Java: Create The Future Keynote
Simon Ritter
 
PDF
Oracle ADF Architecture TV - Design - ADF BC Application Module Design
Chris Muir
 
PPTX
Ed presents JSF 2.2 and WebSocket to Gameduell.
Edward Burns
 
PPT
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG
 
PDF
JSF 2.2 Input Output JavaLand 2015
Edward Burns
 
PDF
Burns jsf-confess-2015
Edward Burns
 
PPTX
Functional programming with_jdk8-s_ritter
Simon Ritter
 
PDF
NetWeaver Gateway- Gateway Service Consumption
SAP PartnerEdge program for Application Development
 
PDF
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Chris Muir
 
PDF
NetWeaver Gateway- Introduction to REST
SAP PartnerEdge program for Application Development
 
PDF
Oracle ADF Architecture TV - Design - Task Flow Navigation Options
Chris Muir
 
PDF
Oracle ADF Architecture TV - Design - Task Flow Overview
Chris Muir
 
PPTX
What's New in Java 8
javafxpert
 
PDF
Oracle ADF Architecture TV - Design - ADF Service Architectures
Chris Muir
 
PPTX
Introduction to SAP Gateway and OData
Chris Whealy
 
PDF
SAP NetWeaver Gateway - Gateway Service Consumption
SAP PartnerEdge program for Application Development
 
PDF
Oracle ADF Architecture TV - Development - Error Handling
Chris Muir
 
PDF
NetWeaver Gateway- Introduction to OData
SAP PartnerEdge program for Application Development
 
PPTX
Java EE for the Cloud
Dmitry Kornilov
 
PDF
Oracle ADF Architecture TV - Design - Service Integration Architectures
Chris Muir
 
Java: Create The Future Keynote
Simon Ritter
 
Oracle ADF Architecture TV - Design - ADF BC Application Module Design
Chris Muir
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Edward Burns
 
Ankara JUG Ağustos 2013 - Oracle ADF
Ankara JUG
 
JSF 2.2 Input Output JavaLand 2015
Edward Burns
 
Burns jsf-confess-2015
Edward Burns
 
Functional programming with_jdk8-s_ritter
Simon Ritter
 
NetWeaver Gateway- Gateway Service Consumption
SAP PartnerEdge program for Application Development
 
Oracle ADF Architecture TV - Design - Architecting for ADF Mobile Integration
Chris Muir
 
NetWeaver Gateway- Introduction to REST
SAP PartnerEdge program for Application Development
 
Oracle ADF Architecture TV - Design - Task Flow Navigation Options
Chris Muir
 
Oracle ADF Architecture TV - Design - Task Flow Overview
Chris Muir
 
What's New in Java 8
javafxpert
 
Oracle ADF Architecture TV - Design - ADF Service Architectures
Chris Muir
 
Introduction to SAP Gateway and OData
Chris Whealy
 
SAP NetWeaver Gateway - Gateway Service Consumption
SAP PartnerEdge program for Application Development
 
Oracle ADF Architecture TV - Development - Error Handling
Chris Muir
 
NetWeaver Gateway- Introduction to OData
SAP PartnerEdge program for Application Development
 
Java EE for the Cloud
Dmitry Kornilov
 
Oracle ADF Architecture TV - Design - Service Integration Architectures
Chris Muir
 

Similar to Leverage Enterprise Integration Patterns with Apache Camel and Twitter (20)

PDF
Apache Camel Introduction
Claus Ibsen
 
KEY
Apache Camel
GenevaJUG
 
KEY
Apache Camel - JEEConf May 2011
Claus Ibsen
 
ZIP
Elegant Systems Integration w/ Apache Camel
Pradeep Elankumaran
 
PPTX
Apache Camel framework Presentation and selection of apache camel for various...
chetansharma041
 
PPTX
Apache camel overview dec 2011
Marcelo Jabali
 
PDF
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
José Román Martín Gil
 
ODP
01 apache camel-intro
RedpillLinpro
 
ODP
Getting Started with Apache Camel - Devconf Conference - February 2013
Claus Ibsen
 
ODP
Getting Started with Apache Camel - Malmo JUG - March 2013
Claus Ibsen
 
PDF
Introduction To Apache Camel
Knoldus Inc.
 
PPT
An introduction to Apache Camel
Kapil Kumar
 
PPT
Riding with camel
Sunitha Satyadas
 
PDF
Apache Camel - FUSE community day London 2010 presentation
Claus Ibsen
 
PDF
Enterprise Integration Patterns with Apache Camel
Ioan Eugen Stan
 
PDF
Solving Enterprise Integration with Apache Camel
Christian Posta
 
ODP
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
Claus Ibsen
 
PDF
Jazoon 2011 - Smart EAI with Apache Camel
Kai Wähner
 
PPTX
The forgotten route: Making Apache Camel work for you
Rogue Wave Software
 
PDF
Apache camel community day - october 2010
Claus Ibsen
 
Apache Camel Introduction
Claus Ibsen
 
Apache Camel
GenevaJUG
 
Apache Camel - JEEConf May 2011
Claus Ibsen
 
Elegant Systems Integration w/ Apache Camel
Pradeep Elankumaran
 
Apache Camel framework Presentation and selection of apache camel for various...
chetansharma041
 
Apache camel overview dec 2011
Marcelo Jabali
 
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
José Román Martín Gil
 
01 apache camel-intro
RedpillLinpro
 
Getting Started with Apache Camel - Devconf Conference - February 2013
Claus Ibsen
 
Getting Started with Apache Camel - Malmo JUG - March 2013
Claus Ibsen
 
Introduction To Apache Camel
Knoldus Inc.
 
An introduction to Apache Camel
Kapil Kumar
 
Riding with camel
Sunitha Satyadas
 
Apache Camel - FUSE community day London 2010 presentation
Claus Ibsen
 
Enterprise Integration Patterns with Apache Camel
Ioan Eugen Stan
 
Solving Enterprise Integration with Apache Camel
Christian Posta
 
Getting started with Apache Camel - Javagruppen Copenhagen - April 2014
Claus Ibsen
 
Jazoon 2011 - Smart EAI with Apache Camel
Kai Wähner
 
The forgotten route: Making Apache Camel work for you
Rogue Wave Software
 
Apache camel community day - october 2010
Claus Ibsen
 
Ad

More from Bruno Borges (20)

PDF
Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
PDF
[Outdated] Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
PDF
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
Bruno Borges
 
PDF
Making Sense of Serverless Computing
Bruno Borges
 
PPTX
Visual Studio Code for Java and Spring Developers
Bruno Borges
 
PDF
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Bruno Borges
 
PDF
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
Bruno Borges
 
PPTX
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Bruno Borges
 
PPTX
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Bruno Borges
 
PPTX
Java EE Arquillian Testing with Docker & The Cloud
Bruno Borges
 
PPTX
Migrating From Applets to Java Desktop Apps in JavaFX
Bruno Borges
 
PDF
Servidores de Aplicação: Por quê ainda precisamos deles?
Bruno Borges
 
PDF
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Bruno Borges
 
PDF
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Bruno Borges
 
PDF
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Bruno Borges
 
PDF
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Bruno Borges
 
PDF
Running Oracle WebLogic on Docker Containers [BOF7537]
Bruno Borges
 
PPTX
Lightweight Java in the Cloud
Bruno Borges
 
PDF
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Bruno Borges
 
PDF
Integrando Oracle BPM com Java EE e WebSockets
Bruno Borges
 
Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
[Outdated] Secrets of Performance Tuning Java on Kubernetes
Bruno Borges
 
From GitHub Source to GitHub Release: Free CICD Pipelines For JavaFX Apps
Bruno Borges
 
Making Sense of Serverless Computing
Bruno Borges
 
Visual Studio Code for Java and Spring Developers
Bruno Borges
 
Taking Spring Apps for a Spin on Microsoft Azure Cloud
Bruno Borges
 
A Look Back at Enterprise Integration Patterns and Their Use into Today's Ser...
Bruno Borges
 
Melhore o Desenvolvimento do Time com DevOps na Nuvem
Bruno Borges
 
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Bruno Borges
 
Java EE Arquillian Testing with Docker & The Cloud
Bruno Borges
 
Migrating From Applets to Java Desktop Apps in JavaFX
Bruno Borges
 
Servidores de Aplicação: Por quê ainda precisamos deles?
Bruno Borges
 
Build and Monitor Cloud PaaS with JVM’s Nashorn JavaScripts [CON1859]
Bruno Borges
 
Cloud Services for Developers: What’s Inside Oracle Cloud for You? [CON1861]
Bruno Borges
 
Booting Up Spring Apps on Lightweight Cloud Services [CON10258]
Bruno Borges
 
Java EE Application Servers: Containerized or Multitenant? Both! [CON7506]
Bruno Borges
 
Running Oracle WebLogic on Docker Containers [BOF7537]
Bruno Borges
 
Lightweight Java in the Cloud
Bruno Borges
 
Tweet for Beer - Beertap Powered by Java Goes IoT, Cloud, and JavaFX
Bruno Borges
 
Integrando Oracle BPM com Java EE e WebSockets
Bruno Borges
 
Ad

Recently uploaded (20)

PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 

Leverage Enterprise Integration Patterns with Apache Camel and Twitter

  • 1. 1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 2. Leverage Enterprise Integration Patterns with Apache Camel and Twitter Bruno Borges Oracle Product Manager for Latin America Java EE, GlassFish, WebLogic, Coherence 2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 3. Who am I? Bruno Borges  Java developer since 2000  Speaker at Conferences – JustJava, JavaOne Brazil, The Developers’ Conference, ApacheCon  Evangelized Apache Camel and Apache Wicket in Brazil  Joined Oracle on July 2012 – Product Manager for Java EE, GlassFish and WebLogic – Latin America  Married, lives in Sao Paulo, has a Golden Retriever, hiker and gamer 3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 4. Agenda  Enterprise Integration Patterns  Introduction to Apache Camel  Social Media and Social Data  Camel Twitter  Demonstration 4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 5. Enterprise Integration Patterns 5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 6. “If you are involved with the operation or development of an enterprise application, there will doubtless come a time when you will need to integrate your application with another using the emerging preferred approach of messaging.” Randy Stafford Oracle 6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 7. Enterprise Integration Patterns Integration, integration, integration…  Why do we need patterns for integration?  Why is it so hard?  Asynchronous messages  Where and when to use them?  Cloud Computing depends on it 7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 8. Apache Camel http://camel.apache.org 8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 9. What is Apache Camel? A Java framework that enables the developer to:  Use implementations of Enterprise Integration Patterns  Design routes for Enterprise Integration Patterns  Use out-of-the-box or develop components and endpoints  Process asynchronous and synchronous messages  Connect distinct and independent systems  Receive, transform and deliver data 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 10. Quick overview of Apache Camel The core of Camel is about  Components  Endpoints  Routes  Exchanges and Messages  Consumers  Producers  Processors 10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 11. What can you do with Apache Camel? Example of exchanging and filtering messages between queues Queue A Queue B 11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 12. What can you do with Apache Camel? Example of exchanging a message between queues Queue A Queue B from to filter queue A queue B 12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 13. What can you do with Apache Camel? Example of exchanging a message between queues Queue A Queue B from(qA) filter() to(qB) 13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 14. Example using Spring Because you love XML <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="file:///var/usr/inbox/"/> <choice> <when> <xpath>$foo = 'widget'</xpath> <to uri="seda:widget"/> </when> <when> <xpath>$foo = 'gadget'</xpath> <to uri="seda:gadget"/> </when> <otherwise> <to uri="seda:lixo"/> </otherwise> </choice> </route> </camelContext> 14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 15. Examples using Scala With the Scala DSL "direct:a" when(_.in == "<hello/>") to("direct:b") "direct:b" ==> { when(_.in == "<hallo/>") { to ("mock:c") } otherwise { to ("mock:e") } to ("mock:d") } 15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 16. Apache Camel Implementation of Enterprise Integration Patterns  DSLs for Java, Spring XML and Scala  Standard URIs for Endpoints  Message routing based on Predicates and Expressions  Lots of components – JMS, HTTP, MINA, JDBC, FTP, WebServices, EJB, JPA, Hibernate, IRC, JCR, AS/400, LDAP, Mail, Nagios, POP, Printers, Quartz, Restlet, RMI, RSS, Scalate, XMPP…  Integrates with CDI – CamelContext can be started with EJB3’s @Startup/@Singleton 16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 17. Social Media and Social Data 17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 18. Social Media The Rise of Social Media as a Communications Channels  29% of consumers post negative comments on social networks  49% of 16-24 y’o have posted negative comment following bad CX  71% that had complaints on social networks were ignored  Of 29% who did get responses, 51% had positive reaction after  17% of those who had a response, wrote a positive comment  13% deleted their negative post Source: 2011 Customer Experience Index Report “The Era of Impatience” http://www.oracle.com/us/products/applications/uk-cei-report-1641675.pdf 18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 19. Social Data Reading and processing all that data  Twitter for instance – Twitter, on average, receives 3,9k tweets per second – Peaks during main events can reach 20k tweets per second – This can more than 300 million tweets per day – One tweet may have 140 characters  560 bytes (Twitter uses UTF-8) – Per day, more than 150 GB of raw text tweets  Not counting indexing and storage overhead  Let’s not forget about Facebook, Google+, LinkedIn and many others 19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 20. Social Data “It is not information overload. It’s filter failure” Clay Shirky Independent Consultant, Teacher and Writer 20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 21. Filtering and Processing Social Data It looks like a lot with Enterprise Integration Patterns, isn’t?  Read status updates  Filter based on general keywords  Identify the issue based on their content  Route to who will best process that tweet  Reply if possible  Store for future conversations with original sender – Store retweets that mention users who thought the same thing  Customize as needed 21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 22. Camel Twitter Component for Apache Camel 22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 23. Camel Twitter The initial idea: March 2009 http://blog.brunoborges.com.br/2009/03/leverage- eip-with-apache-camel-and.html 23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 24. Camel Twitter The initial idea: March 2009 http://blog.brunoborges.com.br/2009/03/leverage- eip-with-apache-camel-and.html 24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 25. Camel Twitter Proposed as a Camel Component to the ASF in 2009  CAMEL-1520 – https://issues.apache.org/jira/browse/CAMEL-1520  Presented at ApacheCon NA’09 during the BarCamp  Discussions with Camel committers at ApacheCon led me to build a broader component, that could support other social networks  Challenge: same URIs and features for different Social Networks (“social data providers”). Starting with Facebook, Twitter, LinkedIn, Foursquare, and (the already dead) Google Buzz 25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 26. Camel Social How would it look like?  Started in 2010  Goal – The Camel Social component objective was to be able to poll social data from several networks in a uniform way to be processed through a route  URI format – social://[social provider] [/social path]?parameters  Features – Post, Read, Search 26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 27. Camel Social Examples Sending a tweet "direct:foo" to "social://twitter/status" Reading a Facebook Timeline "social://facebook/timeline/brunocborges" ==> { to("log:facebookWall") } Searching for events on Facebook "direct:doSearch" to "social://facebook/events" to "log:events" 27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 28. Camel Social An unsuccessful attempt http://code.google.com/p/camel-social  Problem – It was very hard to design an standard API for different Social Nets  Died in 2010  What about Spring Social? – Didn’t exist back then – Now they have an abstract API for Social Providers and for OAuth – One extra API per Social Network – It “could” bring the component back to life 28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 29. Camel Twitter A rebirth, thanks to GitHub  May 2011 – project rebooted on GitHub – Focus only on Twitter  http://github.com/brunoborges/camel-twitter @brettemeyer  Kudos to Brett Meyer, who finished the job  Bilgin Ibryam added support for the Twitter Streaming API  Thank you guys! I owe you two a beer :-) 29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 30. Camel Twitter Final version  Available since Apache Camel 2.10  Features – Send a tweet (update status) – Send and read Direct Messages (DMs) – Search using REST (polling) or Streaming – Sample streaming from public tweets – Timeline reads for home, mentions, retweets, specific user  Uses the well-know Twitter4J library (Apache licensed) 30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 31. Examples Using the Scala DSL Sending a tweet "jms:queue:tweetingQueue1" to "twitter://timeline/user" Reading a Timeline "twitter://timeline/home?type=polling&delay=5" ==> { to("log:homeTweets") } Searching for keywords "direct:doSearch" to "twitter://search?keywords=JavaOne“ to "log:homeTweets" 31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 32. Camel Twitter Demo Searching for pictures about Batman 32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 33. Camel Twitter Demo How it works  Connects to the Search Streaming channel based on keywords  Filter for tweets with media only  Check Coherence Cache and filter duplicates  Put image/tweet URL as key/value on Coherence Cache  Transform tweets into small POJOs  Transform POJOs into JSON Strings  Sends to users connected to the WebSocket channel * based on the Camelympics project developed by Bilgin Ibryam https://github.com/bibryam/camelympics 33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 34. About Camel Coherence Component The #1 Distributed Caching technology  A fork of the Camel Cache component – Instead of EHCache, now uses Oracle Coherence  Same features as the core component – Operations: add, check, get, remove, removeAll – URI: coherence://cacheName  Coherence is LRU by default (‘local-scheme’) – Great for the demo! Stores the recent tweets without blowing the Heap – If more storage is needed, deploy new Coherence Cache instance 34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 35. QUESTIONS? 35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 36. THANK YOU! @brunoborges blogs.oracle.com/brunoborges 36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 37. The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
  • 38. 38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.