org.glassfish.openesb.pojose.api
Interface Consumer


public interface Consumer

Instance of Consumer used to consume Service.

Instance of this class will be injected into JBI Provider field when annotaed with ConsumerEndpoint. Instance can also be obtained from the Context object. Note this class instance is not thread safe and should not be used concurrently.

Author:
gmpatil
See Also:
Context, ConsumerEndpoint

Nested Class Summary
static class Consumer.MessageObjectType
           
 
Method Summary
 javax.jbi.messaging.MessageExchange createInOnlyMessageExchange()
          Creates and returns InOnly MessageExchange.
 javax.jbi.messaging.MessageExchange createInOutMessageExchange()
          Creates and returns InOut MessageExchange.
 javax.xml.namespace.QName getInterface()
          Get the default interface QName associated with this consumer.
 javax.xml.namespace.QName getService()
          Return QName of the Service associated with this consumer.
 javax.jbi.servicedesc.ServiceEndpoint getServiceEndpoint()
          Returns ServiceEndpoint instance associated with this Consumer.
 void send(javax.jbi.messaging.MessageExchange me)
          Sends the ME is asynch mode.
 void sendInOnly(java.lang.Object msg)
          Sends the ME is asynch mode.
 void sendInOut(java.lang.Object msg)
          Sends the ME is asynch mode.
 boolean sendSynch(javax.jbi.messaging.MessageExchange me)
          Sends the MessageExchange in synch mode.
 void sendSynchInOnly(java.lang.Object msg)
          Sends the message to given ServiceEndpoint.
 java.lang.Object sendSynchInOut(java.lang.Object inMsg, Consumer.MessageObjectType outputType)
          Sends the message to given ServiceEndpoint.
 void setDefaultInputMessageType(javax.xml.namespace.QName inpt)
          Input message type to be used inside WSDL 1.1 wrapper JBI message.
 void setDefaultOperationName(javax.xml.namespace.QName opr)
          Operation name to be set on MessageExchange created implicitly by Consumer.
 void setInterface(javax.xml.namespace.QName intf)
          Sets the default interface QName.
 void setService(javax.xml.namespace.QName svc)
          Sets the service QName instance.
 void setServiceEndpoint(javax.jbi.servicedesc.ServiceEndpoint se)
          Sets ServiceEndpoint.
 

Method Detail

setServiceEndpoint

void setServiceEndpoint(javax.jbi.servicedesc.ServiceEndpoint se)
Sets ServiceEndpoint.

Parameters:
se - ServiceEndpoint

getServiceEndpoint

javax.jbi.servicedesc.ServiceEndpoint getServiceEndpoint()
Returns ServiceEndpoint instance associated with this Consumer.

Returns:
ServiceEndpoint

setService

void setService(javax.xml.namespace.QName svc)
Sets the service QName instance. ServiceEndpoint instance if set will take precedence over service QName.

Parameters:
svc - Service QName.

getService

javax.xml.namespace.QName getService()
Return QName of the Service associated with this consumer.

Returns:
QName of the service

setInterface

void setInterface(javax.xml.namespace.QName intf)
Sets the default interface QName.

Parameters:
intf - Interface QName

getInterface

javax.xml.namespace.QName getInterface()
Get the default interface QName associated with this consumer.

Returns:
QName of the default interface.

setDefaultInputMessageType

void setDefaultInputMessageType(javax.xml.namespace.QName inpt)
Input message type to be used inside WSDL 1.1 wrapper JBI message. This is used only during implicit WSDL 1.1 message wrapping.

Parameters:
inpt - QName of input message type.

setDefaultOperationName

void setDefaultOperationName(javax.xml.namespace.QName opr)
Operation name to be set on MessageExchange created implicitly by Consumer.

Parameters:
opr - QName of operation.

createInOnlyMessageExchange

javax.jbi.messaging.MessageExchange createInOnlyMessageExchange()
                                                                throws javax.jbi.messaging.MessagingException
Creates and returns InOnly MessageExchange. Sets and uses ServiceEndpoint if available. Also sets operation, if default is present.

Returns:
Throws:
InOnly - MessagingException
javax.jbi.messaging.MessagingException

createInOutMessageExchange

javax.jbi.messaging.MessageExchange createInOutMessageExchange()
                                                               throws javax.jbi.messaging.MessagingException
Creates and returns InOut MessageExchange. Sets and uses ServiceEndpoint if available. Also sets operation, if default is present.

Returns:
Throws:
InOut - MessagingException
javax.jbi.messaging.MessagingException

sendSynch

boolean sendSynch(javax.jbi.messaging.MessageExchange me)
                  throws MessageException
Sends the MessageExchange in synch mode. User should take care to use appropriate MessageExchange, i.e either InOnly or InOut.

Any MessagingException from delivery channel is wrapped in POJOError.

Uses the available default ServiceEndpoint, Service or Interface in order if all of the above is null in the passed MessageExchange.

Default Operation name is set if it is null on the passed MessageExchange.

Parameters:
me - MessageExchange
Returns:
true if the exchange has been processed and returned by the servicing component, false otherwise.
Throws:
org.glassfish.openesb.pojose.api.POJOError - any MessagingException is also wrapped in this object.
MessageException

send

void send(javax.jbi.messaging.MessageExchange me)
          throws ErrorMessage
Sends the ME is asynch mode.

Parameters:
me - MessageExchange
Throws:
ErrorMessage - any MessagingException is also wrapped in this object.

sendInOnly

void sendInOnly(java.lang.Object msg)
                throws ErrorMessage
Sends the ME is asynch mode. Converts/wraps objects into XML Source. Creates InOnly message exchange and uses ServiceEndpoint, Input message type and Operation name specified on the annotation.

Parameters:
msg -
Throws:
ErrorMessage

sendInOut

void sendInOut(java.lang.Object msg)
               throws ErrorMessage
Sends the ME is asynch mode. Converts/wraps objects into XML Source. Creates InOut message exchange and uses ServiceEndpoint, Input message type and Operation name specified on the annotation.

Parameters:
msg -
Throws:
ErrorMessage

sendSynchInOnly

void sendSynchInOnly(java.lang.Object msg)
                     throws ErrorMessage
Sends the message to given ServiceEndpoint.

Any MessagingException will be wrapped in Error to the caller, including when Delivery channel fails to process the message by returning false.

Implicit object conversion is done as below.
Instance of NormalizedMessage is sent as is.
Instance of Source, Node, String is wrapped with WSDL 1.1 JBI wrapper message elements.

Parameters:
msg - instance of type String, Node, Source or NormalizedMessage.
Throws:
org.glassfish.openesb.pojose.api.Error
ErrorMessage

sendSynchInOut

java.lang.Object sendSynchInOut(java.lang.Object inMsg,
                                Consumer.MessageObjectType outputType)
                                throws MessageException
Sends the message to given ServiceEndpoint.

Any MessagingException will be wrapped in POJOError to the caller including when Delivery channel fails to process the message by returning false.

Implicit input object conversion is done as below.
Instance of NormalizedMessage is sent as is.
Instance of Source, Node and String is wrapped with WSDL 1.1 JBI wrapper message elements before sending it as source in a NormalizedMessage.

Output or returned object conversion is done based on the given MessageObjectType. Implicit WSDL 1.1 JBI message unwrapping is done when returned message is of type String, Node and Source.

Parameters:
inMsg - instance of type String, Node, Source or NormalizedMessage.
Throws:
org.glassfish.openesb.pojose.api.Error
MessageException


Copyright © 2006-2009. All Rights Reserved.