Sie sind auf Seite 1von 54

Mule 2 and Beyond

Ross Mason
CTO, Co-founder,
MuleSource Inc.
Agenda
• What is Mule?
• Introduction to Mule 2
– New platform
– New features
• Beyond Mule 2
– OSGi
• What else is going on with Mule?
– Review
– MuleForge
– MuleIDE

© 2006-2007 MuleSource Inc


What is Mule?

© 2006-2007 MuleSource Inc


Overview

© 2006-2007 MuleSource Inc


What is Mule ESB?

© 2006-2007 MuleSource Inc


Mule 2 - Buzzwords
• “Service Container”
• “Routing and Mediation Engine”
• “Runtime environment”
• “Light-weight, Embeddable”
• “Integration Platform”
• “SOA backbone”
• “Distributed Application
Environment”

© 2006-2007 MuleSource Inc


Spring features in Mule
• Namespace Handlers
– Schema based Configuration
– Xml no longer contains framework class name
– Much more descriptive
– IDE / Editor friendly: code completion
• AOP Support
– New validation and monitoring possibilities
• Improved Transaction Integration
• JDBC / DAO support

© 2006-2007 MuleSource Inc


Namespace Handlers

• Mule 1.x Configuration

1 <connector name="jms" className="org.mule.providers.jms.JmsConnector">


2 <properties>
3 <property name="specification" value="1.1"/>
4 <container-property name="connectionFactory" ref="myCF"/>
5 <property name="useJndiDestinations" value="true"/>
6 </properties>
7 <connection-strategy className="o.m.p.SimpleRetryConnectionStrategy">
8 <properties>
9 <property name="retryCount" value="10"/>
10 <property name="retryFrequency" value="10000"/>
11 </properties>
12 </connection-strategy>
13 </connector>

© 2006-2007 MuleSource Inc


Namespace Handlers

• Mule 2.0 Configuration


<jms:connector name=”jmsConn” useJndiDestinations="true">
<property name="connectionFactory"><ref local="myCF"/></property>
<mule:connection-strategy-retry retryCount="10" retryFrequency="10000"/>
</jms:connector>

– No class names
– Properties are defined in the schema
– Validation that the properties are set correctly

© 2006-2007 MuleSource Inc


Using different modules (namespaces)
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:jdbc="http://www.mulesource.org/schema/mule/jdbc/2.0">

<jdbc:connector name="jdbcConnector1">
<jdbc:dataSource instance-ref=”ds" scope="singleton"/>
<jdbc:queries>
<spring:entry key="get" value="SELECT ID, TYPE FROM TEST WHERE TYPE = ${type}"/>
</jdbc:queries>
</jdbc:connector>
. . .

<endpoint name=”jdbcEndpoint" address="jdbc://get?type=1”/>

<spring:bean id="ds" class="o.s.jdbc.datasource.DriverManagerDataSource">


<spring:property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<spring:property name="url" value="jdbc:hsqldb:mem:."/>
<spring:property name="username" value="sa"/>
<spring:property name="password" value=""/>
</spring:bean>

<mule/>

© 2006-2007 MuleSource Inc


Configuration Repository

• Configuration can
be managed
centrally or per
server.
• Support for multiple
repositories.
• Mix and match
configurations for
different apps.

© 2006-2007 MuleSource Inc


Under the Covers
• No more Mule Manager
– Replaced by ManagementContext
• Better Lifecycle support
– Registries manage object lifecycle
• Performance Optimization
• Improved QA
• OSGi Ready

© 2006-2007 MuleSource Inc


Mule Streaming

• Allows services to consume very large events in an


efficient way
• Event payloads are not read into memory
• Simple routing rules based on event meta-data still
possible
• Can combine Streaming and non-streaming
endpoints
• Support for Streaming Transformers…
– on the todo list
• Streaming support in Mule 2:
– SOAP, File, FTP, FTPS, TCP, SSL, HTTP and HTTPS

© 2006-2007 MuleSource Inc


Streaming Example
<spring:bean name=”streamBean" class=”com.myco.MyStreamingComponent”/>

<model-streaming name="main">
<service name=”fileTcpBridge">
<component instance-ref=”streamBean" scope=”pooled”>
<inbound-router>
<endpoint address="file://${mule.working.dir}/in"/>
</inbound-router>
<outbound-router>
<pass-through-router>
<endpoint address="tcp://localhost:34561"/>
</pass-through-router>
</outbound-router>
</service>
</model-streaming>

• Streaming components are hosted in the streaming-model


• In Mule 2.0 the Streaming behaviour can be ‘discovered’
• Can mix non-streaming components by adding different component
models

© 2006-2007 MuleSource Inc


Calling out to another service

• Using Java interface bindings

© 2006-2007 MuleSource Inc


Nested Router Bindings
<mule:service name=”AmulzonService" implementation=”amulzonBean">
<mule:inbound-router>
<mule:endpoint address=”stream://System.in"/>
<mule:endpoint address=“xfire:http://localhost:8081/services”/>
</mule:inbound-router>

<mule:nested-router>
<mule:binding interface="o.m.examples.amulzon.CreditChecker">
<mule:endpoint address=”http://creditchecker.com/rest/Validate”/>
</mule:binding>
</mule:nested-router>

<mule:outbound-router>
. . . .

public interface CreditChecker


{
public void validate(PaymentDetails pd) throws ValidationException;
}

© 2006-2007 MuleSource Inc


Implementation
public class AmulzonService implements BookstoreService {

private CreditChecker creditChecker;

public ProcessedOrder process(Order order) {


ProcessedOrder po = new ProcessedOrder(order);
try {
creditChecker.validate(order.getPaymentDetails());
po.setSuccessful(“Order was processed sucessfully”);
} catch (ValidationException e) {
po.setFailed(e.getMessage());
}
return po;
<mule:nested-router>
}
<mule:binding interface="o.m.examples.amulzon.CreditChecker">
// setCreditChecker(..), getCreditChecker()
} <mule:endpoint address=”http://creditchecker.com/rest/Validate”/>

</mule:binding>

</mule:nested-router>

© 2006-2007 MuleSource Inc


Looking ahead

Beyond Mule 2.0

© 2006-2007 MuleSource Inc


What is OSGi?

• Open Services Gateway Initiative

• Dynamic module system for Java

• A sort of Java OS

• SOA within your app!

© 2006-2007 MuleSource Inc


Benefits of OSGi
 Plug & Play!

 Change parts of your app. dynamically without


requiring restarts

 Components dynamically discover each other for


collaboration

 Increased security: more isolation between modules of


your app.

© 2006-2007 MuleSource Inc


Industry Support
• Plug-in model for Eclipse IDE (Equinox)

• Embraced by Spring

• IBM Websphere 6.1

• JSR 291: Dynamic Component Support for Java


– Supporters: Apache, BEA, IBM, Intel, Nokia, Nortel Networks

© 2006-2007 MuleSource Inc


Benefits of OSGi in Mule
• Hot deploy your Mule app just like you would a WAR file, EAR
file, etc. in J2EE
Hot Deploy

• A Mule config can use different versions of the same class

Change Management
• Update and restart a part of your running Mule instance without
having to restart all of it

High Availability

• Dynamically configure Mule instances. Only load what is


required.

© 2006-2007 MuleSource Inc


Benefits of OSGi for Mule
• Separate class loader per bundle – not all of Mule has to
depend on the same version of a 3rd party library

Dependency Mgmt.

• Simple, tried and tested deployment model for Mule


Applications: Bundles

Deployment Model

• Enabling technology for Patch Management in MuleHQ

Patch Mgmt.

© 2006-2007 MuleSource Inc


How it works
• The Framework manages Bundles and Services:
Bundles – static libraries, may or may not be
startable/stoppable (via BundleActivator interface)
Services – dynamic components managed by a registry
similar to JNDI

© 2006-2007 MuleSource Inc


Bundles
• Each Mule module/transport is an
OSGi “bundle” containing a special
manifest file

• The bundle manifest declares:


– Packages provided by this bundle (static)
– Services provided by this bundle (dynamic)
– Required/optional packages (static dependencies)
– Required/optional services (dynamic dependencies)

• Both packages and services have a version associated


which is useful for change management

© 2006-2007 MuleSource Inc


Lifecycle
• The framework manages bundles according to a well-
defined lifecycle.

© 2006-2007 MuleSource Inc


Lifecycle
• The lifecycle state for each bundle is
persistent in case of a system crash or
restart
Failover

• The framework keeps a timeline of


each bundle's lifecycle events for
sysadmins
Audit Trail

• Bundles can be grouped into “run


levels” (like Unix services) and brought
up/down in a layered approach

© 2006-2007 MuleSource Inc


Service Registry
• Mule bundles register their available services (connectors,
transformers, components, etc.) in the OSGi Service Registry.

• A user's Mule app. then looks up the needed services from the
Registry and binds to them.

• Mule services may appear/disappear and consumers must react


accordingly.

• This decoupling is what makes hot updates possible.

© 2006-2007 MuleSource Inc


Spring OSGi
• Spring OSGi hides the details of registering and
consuming OSGi services, using sensible defaults
where possible.

• Details may be given in a simple, declarative form


within the Spring Beans config file:
– cardinality of dependent services
– handling of ServiceNotAvailable exceptions
– timeouts

© 2006-2007 MuleSource Inc


Looking Forward
• OSGi will be the foundation for future versions of
Mule

• It will enable innovative new features for the Mule


platform, Including:
– Hot deployment of services and the Mule modules
– Versioning of services
– Better failure handling and up time
– Simple and scalable Deployment Model
– Better isolation and security between modules

© 2006-2007 MuleSource Inc


What else is going on?

2007… so far

© 2006-2007 MuleSource Inc


Open Source Roadmap

© 2006-2007 MuleSource Inc


Even faster adoption!
• Almost 800,000 downloads so far
• User community growing (over 2000 developers)
– Mule becoming popular in Asia and Australia
• Customers as well as users
– Walmart case study on TSS :
“Mule can do everything the commercial ESBs can, at a lower TCO,
it’s more complete than other open-source offerings like OpenESB, it
complies with more standards (de facto or formal) than commercial
products, and it’s ideal for preventing vendor lock-in.”

© 2006-2007 MuleSource Inc


MuleCon
• First MuleCon event, San Francisco
• 2 days, 150 attendees each day
• Training day
• 6 Customer Testimonials
– Including Walmart, Scripps and H&R Block
• Finished off with pool and beer!

© 2006-2007 MuleSource Inc


- Virtual Tax Services
• Created a virtual
network of Tax
Professionals
capable of serving
customers
regardless of
location

Establish reusable framework for H&R Block office


integration
Real-time, asynchronous communications platform for
all 13,000 offices

© 2006-2007 MuleSource Inc


- Mule Mash-Up!
• Web scraping for RSS aggregation
• Email sender listening to JMS for messages to be
sent
• Distributed search of Lucene indices
• Client of PA Sports Ticker
• Tasking Accucast via RMI
• JMX statistics aggregation and control
• Quartz scheduling - no more cron jobs!
• Tibco RV and Cocoon extensions now on
MuleForge!

© 2006-2007 MuleSource Inc


- Powered by Mule

© 2006-2007 MuleSource Inc


MuleForge
• What is it?
– Mule community site
– Launched 4th September 2007
• Why Contribute?
– 58.3% of users build Mule extensions
– Most Mule extensions are not mission
critical and may be useful to others -
donate it!
• What’s there?
– Over 40 projects hosted already
– SAP, SalesForce, SIP, JCR, CXF, SMS,
Asterix, JavaSpaces, AMPQ
(RabbitMQ), …
– Full project collaboration site

© 2006-2007 MuleSource Inc


MuleForge 1.0
• Project Portal
• SVN and Fisheye
• Jira Issue Tracker
• Confluence Wiki
• Bamboo CI
• Mailing lists
• Maven 2
• Release Mgmt
• RSS Feeds
• Next version
– Knowledge base
– Metrics
– SSO
– Contributed content www.muleforge.org

© 2006-2007 MuleSource Inc


Mule IDE 2.0 - Eclipse
• Eclipse-based IDE
– Current Mule 1.3
• Mule project wizard
• Example projects
• Runnable profiles

• In MuleIDE 2.0
– Drag n’ Drop configuration
– Extensible graphical palette
– Xml Round tripping
• switch between graphical
editor and Mule Xml
• No loss of structure or
comments
– Extensible graphical editing
– More project
wizards/templates

© 2006-2007 MuleSource Inc


Product Releases
• Mule 1.4 Released in April
• Mule 2.0 milestone 1 Released in August
• MuleForge 1.0 Release in September
• MuleOnDemand 1.0 beta in September

• Mule 2.0 Release Candidate out in Q4 2007


• MuleIDE 2.0 out in Q1 2008

© 2006-2007 MuleSource Inc


Awards

AlwaysOn Top 100

© 2006-2007 MuleSource Inc


Any Questions…

for Captain Mule?

© 2006-2007 MuleSource Inc


I’ll never have time
for these

© 2006-2007 MuleSource Inc


Code Dive

Code Jump

© 2006-2007 MuleSource Inc


Amulzon Bookstore

© 2006-2007 MuleSource Inc


Mmmm… Code
• The AmulzonService is a POJO that implements an BookstoreService
interface

public interface BookstoreService {


public ProcessedOrder process(Order order);
}

• The implementation (the POJO to be managed by Mule) looks like -

public class Amulzon implements BookstoreService {


public ProcessedOrder process(Order order) {
// do something with the order and return
ProcessedOrder po = new ProcessedOrder(order);
po.setSuccessful(“Orer was processed sucessfully”);
return po;
}
}

© 2006-2007 MuleSource Inc


Domain objects are the Messages
• Order.class
– PaymentDetails
– Customer Details
– Ordered items
• ProcessedOrder.class
– The Order
– Success Message
– Failed Message

© 2006-2007 MuleSource Inc


Configuring the Amulzon Bookstore
<spring:bean name=”amulzonBean" class="o.m.e.bookstore.AmulzonService”/>

<custom-transformer name=”StringToOrder" class=”o.m.e.bookstore.StringToOrder”/>

<service name=”AmulzonService">
<component instance-ref=”amulzonBean" scope=”pooled”/>
<inbound-router>
<endpoint address=”stream://System.in” transformers”StringToOrder” />
</inbound-router>

<outbound-router>
<pass-through-router>
<endpoint address=”stream://System.out”/>
</pass-through-router>
</outbound-router>
</service>

© 2006-2007 MuleSource Inc


Exposing as a Web Service

© 2006-2007 MuleSource Inc


Exposing as a Web Service
<service name=”AmulzonService">
<component instance-ref=”amulzonBean" scope=”pooled”/>
<inbound-router>
<endpoint address="stream://System.in"/>
<endpoint address=”xfire:http://localhost:8081/services"/>
</inbound-router>
<outbound-router>
<pass-through-router>
<endpoint address="stream://System.out"/>
</pass-through-router>
Tell mule to The SOAP Expose the
The SOAP
</outbound-router> Context for the
use the XFire transport Service to
Service name service
</service> Transport protocol localhost

Getting the WSDL


• http://localhost:8081/services/AmulzonService?wsdl

© 2006-2007 MuleSource Inc


Calling out to another service
• Using Java interface bindings

© 2006-2007 MuleSource Inc


Nested Router Bindings
<mule:service name=”AmulzonService" implementation=”amulzonBean">
<mule:inbound-router>
<mule:endpoint address=”stream://System.in"/>
<mule:endpoint address=“xfire:http://localhost:8081/services”/>
</mule:inbound-router>

<mule:nested-router>
<mule:binding interface="o.m.examples.amulzon.CreditChecker">
<mule:endpoint address=”http://creditchecker.com/rest/Validate”/>
</mule:binding>
</mule:nested-router>

<mule:outbound-router>
. . . .

public interface CreditChecker


{
public void validate(PaymentDetails pd) throws ValidationException;
}

© 2006-2007 MuleSource Inc


Amulzon Implementation
public class AmulzonService implements BookstoreService {

private CreditChecker creditChecker;

public ProcessedOrder process(Order order) {


ProcessedOrder po = new ProcessedOrder(order);
try {
creditChecker.validate(order.getPaymentDetails());
po.setSuccessful(“Order was processed sucessfully”);
} catch (ValidationException e) {
po.setFailed(e.getMessage());
}
return po;
<mule:nested-router>
}
<mule:binding interface="o.m.examples.amulzon.CreditChecker">
// setCreditChecker(..), getCreditChecker()
} <mule:endpoint address=”http://creditchecker.com/rest/Validate”/>

</mule:binding>

</mule:nested-router>

© 2006-2007 MuleSource Inc

Das könnte Ihnen auch gefallen