org.apache.servicemix.jbi.api
Interface ServiceMixClient


public interface ServiceMixClient

Represents a client API which allows users to programatically send messages into the JBI container or to receive them using the regular JBI API together with a collection of helper methods making it easier to interact with the JBI API.

Version:
$Revision: 564374 $

Method Summary
 void close()
          Close this client.
 Destination createDestination(java.lang.String uri)
          Creates a destination which represents some JBI endpoint that message exchanges can be created with.
 javax.jbi.messaging.InOnly createInOnlyExchange()
          Creates an InOnly (one way) message exchange.
 javax.jbi.messaging.InOnly createInOnlyExchange(EndpointResolver resolver)
          Creates an InOnly (one way) message exchange with the given resolver.
 javax.jbi.messaging.InOptionalOut createInOptionalOutExchange()
          Creates an InOptionalOut (optional request-reply) message exchange.
 javax.jbi.messaging.InOptionalOut createInOptionalOutExchange(EndpointResolver resolver)
          Creates an InOptionalOut (optional request-reply) message exchange with the given resolver.
 javax.jbi.messaging.InOut createInOutExchange()
          Creates an InOut (request-reply) message exchange.
 javax.jbi.messaging.InOut createInOutExchange(EndpointResolver resolver)
          Creates an InOut (request-reply) message exchange with the given resolver.
 EndpointResolver createResolverForExternalInterface(javax.xml.namespace.QName interfaceName)
          Creates an endpoint for the given external interface
 EndpointResolver createResolverForExternalInterface(javax.xml.namespace.QName service, java.lang.String endpoint)
          Creates an endpoint resolver for the given service and endpoint name
 EndpointResolver createResolverForExternalService(javax.xml.namespace.QName service)
          Creates an endpoint for the given external service name
 EndpointResolver createResolverForService(javax.xml.namespace.QName service)
          Creates an endpoint resolver for the given service name
 EndpointResolver createResolverInterface(javax.xml.namespace.QName interfaceName)
          Creates an endpoint resolver for the given interface name
 javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange()
          Creates an RobustInOnly (one way) message exchange.
 javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange(EndpointResolver resolver)
          Creates an RobustInOnly (one way) message exchange with the given resolver.
 void done(javax.jbi.messaging.MessageExchange exchange)
          A helper method to indicate that the message exchange is complete which will set the status to ExchangeStatus.DONE and send the message on the delivery channel.
 void fail(javax.jbi.messaging.MessageExchange exchange, java.lang.Exception error)
          A helper method which fails and completes the given exchange with the specified exception
 void fail(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.Fault fault)
          A helper method which fails and completes the given exchange with the specified fault
 javax.jbi.component.ComponentContext getContext()
          Returns the current component context which can be used to activate endpoints, components and query the available service endpoints.
 javax.jbi.messaging.DeliveryChannel getDeliveryChannel()
          Returns the delivery channel for this client's message exchanges
 javax.jbi.messaging.MessageExchangeFactory getExchangeFactory()
          Returns the default message exchange factory.
 javax.jbi.messaging.MessageExchange receive()
          Receives an inbound message exchange, blocking forever until one is available.
 javax.jbi.messaging.MessageExchange receive(long timeout)
          Receives an inbound message exchange, blocking until the given timeout period.
 java.lang.Object request(EndpointResolver resolver, java.util.Map exchangeProperties, java.util.Map inMessageProperties, java.lang.Object content)
          Performs a request-response (using an InOut to the endpoint denoted by the given resolver, blocking until the response is received and then returning the result.
 java.lang.Object request(java.util.Map inMessageProperties, java.lang.Object content)
          Performs a request-response (using an InOut to the endpoint denoted by the given resolver, blocking until the response is received and then returning the result.
 javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(java.lang.String uri)
          Resolves a WS-Addressing endpoint reference String into a JBI ServiceEndpoint reference so that message exchanges can be directed to an endpoint
 void send(EndpointResolver resolver, java.util.Map exchangeProperties, java.util.Map inMessageProperties, java.lang.Object content)
          Sends a one way message exchange to the endpoint denoted by the given resolver
 void send(java.util.Map inMessageProperties, java.lang.Object content)
          Sends a one way message exchange to the endpoint denoted by the given resolver
 void send(Message message)
          Sends an In-Only message
 void send(javax.jbi.messaging.MessageExchange exchange)
          Sends the message exchange to the endpoint.
 boolean sendSync(EndpointResolver resolver, java.util.Map exchangeProperties, java.util.Map inMessageProperties, java.lang.Object content)
          Sends a one way message exchange to the endpoint denoted by the given resolver and blocks until the send is completed.
 boolean sendSync(java.util.Map inMessageProperties, java.lang.Object content)
          Sends a one way message exchange to the endpoint denoted by the given resolver and blocks until the send is completed.
 boolean sendSync(javax.jbi.messaging.MessageExchange exchange)
          Sends the message exchange to the endpoint, blocking until the send has completed.
 boolean sendSync(javax.jbi.messaging.MessageExchange exchange, long timeout)
          Sends the message exchange to the endpoint, blocking until the send has completed or the specified timeout has elapsed.
 

Method Detail

send

void send(javax.jbi.messaging.MessageExchange exchange)
          throws javax.jbi.messaging.MessagingException
Sends the message exchange to the endpoint.

Parameters:
exchange -
Throws:
javax.jbi.messaging.MessagingException

send

void send(Message message)
          throws javax.jbi.messaging.MessagingException
Sends an In-Only message

Parameters:
message -
Throws:
javax.jbi.messaging.MessagingException

sendSync

boolean sendSync(javax.jbi.messaging.MessageExchange exchange)
                 throws javax.jbi.messaging.MessagingException
Sends the message exchange to the endpoint, blocking until the send has completed.

Parameters:
exchange -
Returns:
true if the exchange has been processed and returned by the servicing component, false otherwise.
Throws:
javax.jbi.messaging.MessagingException

sendSync

boolean sendSync(javax.jbi.messaging.MessageExchange exchange,
                 long timeout)
                 throws javax.jbi.messaging.MessagingException
Sends the message exchange to the endpoint, blocking until the send has completed or the specified timeout has elapsed.

Parameters:
exchange -
timeout -
Returns:
true if the exchange has been processed and returned by the servicing component, false otherwise.
Throws:
javax.jbi.messaging.MessagingException

receive

javax.jbi.messaging.MessageExchange receive()
                                            throws javax.jbi.messaging.MessagingException
Receives an inbound message exchange, blocking forever until one is available.

Returns:
the received message exchange
Throws:
javax.jbi.messaging.MessagingException

receive

javax.jbi.messaging.MessageExchange receive(long timeout)
                                            throws javax.jbi.messaging.MessagingException
Receives an inbound message exchange, blocking until the given timeout period.

Parameters:
timeout - the maximum amount of time to wait for a message
Returns:
the received message exchange or null if the timeout occurred.
Throws:
javax.jbi.messaging.MessagingException

request

java.lang.Object request(EndpointResolver resolver,
                         java.util.Map exchangeProperties,
                         java.util.Map inMessageProperties,
                         java.lang.Object content)
                         throws javax.jbi.JBIException
Performs a request-response (using an InOut to the endpoint denoted by the given resolver, blocking until the response is received and then returning the result.

Parameters:
resolver - the resolver used to resolve and choose the endpoint, which if null is used then the container configured routing rules are used to dispatch the message to the destination
exchangeProperties - the properties used for the exchange or null if no properties are required
inMessageProperties - the properties used for the in message or null if no properties are required
content - the body of the message
Throws:
javax.jbi.JBIException - if the message could not be dispatched for some reason.

send

void send(EndpointResolver resolver,
          java.util.Map exchangeProperties,
          java.util.Map inMessageProperties,
          java.lang.Object content)
          throws javax.jbi.JBIException
Sends a one way message exchange to the endpoint denoted by the given resolver

Parameters:
resolver - the resolver used to resolve and choose the endpoint, which if null is used then the container configured routing rules are used to dispatch the message to the destination
exchangeProperties - the properties used for the exchange or null if no properties are required
inMessageProperties - the properties used for the in message or null if no properties are required
content - the body of the message
Throws:
javax.jbi.JBIException - if the message could not be dispatched for some reason.

sendSync

boolean sendSync(EndpointResolver resolver,
                 java.util.Map exchangeProperties,
                 java.util.Map inMessageProperties,
                 java.lang.Object content)
                 throws javax.jbi.JBIException
Sends a one way message exchange to the endpoint denoted by the given resolver and blocks until the send is completed.

Parameters:
resolver - the resolver used to resolve and choose the endpoint, which if null is used then the container configured routing rules are used to dispatch the message to the destination
exchangeProperties - the properties used for the exchange or null if no properties are required
inMessageProperties - the properties used for the in message or null if no properties are required
content - the body of the message
Returns:
true if the exchange has been processed and returned by the servicing component, false otherwise.
Throws:
javax.jbi.JBIException - if the message could not be dispatched for some reason.

request

java.lang.Object request(java.util.Map inMessageProperties,
                         java.lang.Object content)
                         throws javax.jbi.JBIException
Performs a request-response (using an InOut to the endpoint denoted by the given resolver, blocking until the response is received and then returning the result.

Parameters:
inMessageProperties - the properties used for the in message or null if no properties are required
content - the body of the message
Throws:
javax.jbi.JBIException - if the message could not be dispatched for some reason.

send

void send(java.util.Map inMessageProperties,
          java.lang.Object content)
          throws javax.jbi.JBIException
Sends a one way message exchange to the endpoint denoted by the given resolver

Parameters:
inMessageProperties - the properties used for the in message or null if no properties are required
content - the body of the message
Throws:
javax.jbi.JBIException - if the message could not be dispatched for some reason.

sendSync

boolean sendSync(java.util.Map inMessageProperties,
                 java.lang.Object content)
                 throws javax.jbi.JBIException
Sends a one way message exchange to the endpoint denoted by the given resolver and blocks until the send is completed.

Parameters:
inMessageProperties - the properties used for the in message or null if no properties are required
content - the body of the message
Returns:
true if the exchange has been processed and returned by the servicing component, false otherwise.
Throws:
javax.jbi.JBIException - if the message could not be dispatched for some reason.

createInOnlyExchange

javax.jbi.messaging.InOnly createInOnlyExchange()
                                                throws javax.jbi.messaging.MessagingException
Creates an InOnly (one way) message exchange.

Returns:
the newly created message exchange
Throws:
javax.jbi.messaging.MessagingException

createInOnlyExchange

javax.jbi.messaging.InOnly createInOnlyExchange(EndpointResolver resolver)
                                                throws javax.jbi.JBIException
Creates an InOnly (one way) message exchange with the given resolver.

Returns:
the newly created message exchange
Throws:
javax.jbi.messaging.MessagingException
javax.jbi.JBIException

createInOutExchange

javax.jbi.messaging.InOut createInOutExchange()
                                              throws javax.jbi.messaging.MessagingException
Creates an InOut (request-reply) message exchange.

Returns:
the newly created message exchange
Throws:
javax.jbi.messaging.MessagingException

createInOutExchange

javax.jbi.messaging.InOut createInOutExchange(EndpointResolver resolver)
                                              throws javax.jbi.JBIException
Creates an InOut (request-reply) message exchange with the given resolver.

Returns:
the newly created message exchange
Throws:
javax.jbi.messaging.MessagingException
javax.jbi.JBIException

createInOptionalOutExchange

javax.jbi.messaging.InOptionalOut createInOptionalOutExchange()
                                                              throws javax.jbi.messaging.MessagingException
Creates an InOptionalOut (optional request-reply) message exchange.

Returns:
the newly created message exchange
Throws:
javax.jbi.messaging.MessagingException

createInOptionalOutExchange

javax.jbi.messaging.InOptionalOut createInOptionalOutExchange(EndpointResolver resolver)
                                                              throws javax.jbi.JBIException
Creates an InOptionalOut (optional request-reply) message exchange with the given resolver.

Returns:
the newly created message exchange
Throws:
javax.jbi.messaging.MessagingException
javax.jbi.JBIException

createRobustInOnlyExchange

javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange()
                                                            throws javax.jbi.messaging.MessagingException
Creates an RobustInOnly (one way) message exchange.

Returns:
the newly created message exchange
Throws:
javax.jbi.messaging.MessagingException

createRobustInOnlyExchange

javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange(EndpointResolver resolver)
                                                            throws javax.jbi.JBIException
Creates an RobustInOnly (one way) message exchange with the given resolver.

Returns:
the newly created message exchange
Throws:
javax.jbi.messaging.MessagingException
javax.jbi.JBIException

resolveEndpointReference

javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(java.lang.String uri)
Resolves a WS-Addressing endpoint reference String into a JBI ServiceEndpoint reference so that message exchanges can be directed to an endpoint

Parameters:
uri - the WS-Addressing endpoint reference string

createResolverForService

EndpointResolver createResolverForService(javax.xml.namespace.QName service)
Creates an endpoint resolver for the given service name

Parameters:
service -
Returns:
the newly created entity resolver

createResolverInterface

EndpointResolver createResolverInterface(javax.xml.namespace.QName interfaceName)
Creates an endpoint resolver for the given interface name

Parameters:
interfaceName -
Returns:
the newly created entity resolver

createResolverForExternalService

EndpointResolver createResolverForExternalService(javax.xml.namespace.QName service)
Creates an endpoint for the given external service name

Parameters:
service -
Returns:
the newly created entity resolver

createResolverForExternalInterface

EndpointResolver createResolverForExternalInterface(javax.xml.namespace.QName interfaceName)
Creates an endpoint for the given external interface

Parameters:
interfaceName -
Returns:
the newly created entity resolver

createResolverForExternalInterface

EndpointResolver createResolverForExternalInterface(javax.xml.namespace.QName service,
                                                    java.lang.String endpoint)
Creates an endpoint resolver for the given service and endpoint name

Parameters:
service -
endpoint -
Returns:
the newly created entity resolver

createDestination

Destination createDestination(java.lang.String uri)
                              throws javax.jbi.messaging.MessagingException
Creates a destination which represents some JBI endpoint that message exchanges can be created with.

Throws:
javax.jbi.messaging.MessagingException

done

void done(javax.jbi.messaging.MessageExchange exchange)
          throws javax.jbi.messaging.MessagingException
A helper method to indicate that the message exchange is complete which will set the status to ExchangeStatus.DONE and send the message on the delivery channel.

Parameters:
exchange -
Throws:
javax.jbi.messaging.MessagingException

fail

void fail(javax.jbi.messaging.MessageExchange exchange,
          javax.jbi.messaging.Fault fault)
          throws javax.jbi.messaging.MessagingException
A helper method which fails and completes the given exchange with the specified fault

Throws:
javax.jbi.messaging.MessagingException

fail

void fail(javax.jbi.messaging.MessageExchange exchange,
          java.lang.Exception error)
          throws javax.jbi.messaging.MessagingException
A helper method which fails and completes the given exchange with the specified exception

Throws:
javax.jbi.messaging.MessagingException

getContext

javax.jbi.component.ComponentContext getContext()
Returns the current component context which can be used to activate endpoints, components and query the available service endpoints.

Returns:
the component context

getDeliveryChannel

javax.jbi.messaging.DeliveryChannel getDeliveryChannel()
                                                       throws javax.jbi.messaging.MessagingException
Returns the delivery channel for this client's message exchanges

Returns:
the delivery channel on which all this clients exchanges will occur.
Throws:
javax.jbi.messaging.MessagingException

getExchangeFactory

javax.jbi.messaging.MessageExchangeFactory getExchangeFactory()
                                                              throws javax.jbi.messaging.MessagingException
Returns the default message exchange factory.

Returns:
the default message exchange factory.
Throws:
javax.jbi.messaging.MessagingException

close

void close()
           throws javax.jbi.JBIException
Close this client.

Throws:
javax.jbi.JBIException


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.