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
 MessageExchange createInOnlyMessageExchange()
          Creates and returns InOnly MessageExchange.
 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.
 ServiceEndpoint getServiceEndpoint()
          Returns ServiceEndpoint instance associated with this Consumer.
 void send(MessageExchange me)
          Sends the ME is asynch mode.
 void send(MessageExchange me, boolean propagateTxn)
          Sends the ME is asynch mode.
 void sendInOnly(java.lang.Object msg)
          Sends the ME is asynch mode.
 void sendInOnly(java.lang.Object msg, boolean propTxn)
          Sends the ME is asynch mode.
 void sendInOut(java.lang.Object msg)
          Sends the ME is asynch mode.
 void sendInOut(java.lang.Object msg, boolean propTxn)
          Sends the ME is asynch mode.
 boolean sendSynch(MessageExchange me)
          Sends the MessageExchange in synch mode.
 boolean sendSynch(MessageExchange me, long timeout)
          Sends the MessageExchange in synch mode.
 void sendSynchInOnly(java.lang.Object msg)
          Sends the message to given ServiceEndpoint.
 void sendSynchInOnly(java.lang.Object msg, long timeout)
          Sends the message to given ServiceEndpoint.
 java.lang.Object sendSynchInOut(java.lang.Object inMsg, Consumer.MessageObjectType outputType)
          Sends the message to given ServiceEndpoint.
 java.lang.Object sendSynchInOut(java.lang.Object inMsg, Consumer.MessageObjectType outputType, long timeout)
          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(ServiceEndpoint se)
          Sets ServiceEndpoint.
 

Method Detail

setServiceEndpoint

void setServiceEndpoint(ServiceEndpoint se)
Sets ServiceEndpoint.

Parameters:
se - ServiceEndpoint

getServiceEndpoint

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

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

Returns:
Throws:
MessagingException

createInOutMessageExchange

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

Returns:
Throws:
MessagingException

sendSynch

boolean sendSynch(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

sendSynch

boolean sendSynch(MessageExchange me,
                  long timeout)
                  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
timeout -
Returns:
true if the exchange has been processed and returned by the servicing component, false in the case of timeout.
Throws:
org.glassfish.openesb.pojose.api.POJOError - any MessagingException is also wrapped in this object.
MessageException

send

void send(MessageExchange me)
          throws ErrorMessage
Sends the ME is asynch mode. Transaction object is not propagated by default, in asynch mode. Use overloaded method to explicitly suspend and propagate transaction object if one is available in provisioning message exchange.

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


send

void send(MessageExchange me,
          boolean propagateTxn)
          throws ErrorMessage
Sends the ME is asynch mode. Paramter propagateTxn is used to suspend and propgating the Transaction object or continue in current thread if one available.

Parameters:
me - MessageExchange
propagateTxn - boolean, true - propagate transaction, false other wise.
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.

Transaction object is not propagated by default, in asynch mode. Use overloaded method to explicitly suspend and propagate transaction object if one is available in provisioning message exchange.

Parameters:
msg -
Throws:
ErrorMessage
See Also:
sendInOnly(java.lang.Object, boolean)

sendInOnly

void sendInOnly(java.lang.Object msg,
                boolean propTxn)
                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. Paramter propTxn is used to suspend and propgating the Transaction object or continue in current thread if one available.

Parameters:
msg -
propTxn - true to propagate the Transaction if available.
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.

Transaction object is not propagated by default, in asynch mode. Use overloaded method to explicitly suspend and propagate transaction object if one is available in provisioning message exchange.

Parameters:
msg -
Throws:
ErrorMessage
See Also:
sendInOut(java.lang.Object, boolean)

sendInOut

void sendInOut(java.lang.Object msg,
               boolean propTxn)
               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. Paramter propTxn is used to suspend and propgating the Transaction object or continue in current thread if one available.

Parameters:
msg -
propTxn - true to propagate the Transaction if available.
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:
ErrorMessage

sendSynchInOnly

void sendSynchInOnly(java.lang.Object msg,
                     long timeout)
                     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.
timeout -
Throws:
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.
outputType - - value to be returned of type.
Returns:
object of type outputType
Throws:
MessageException

sendSynchInOut

java.lang.Object sendSynchInOut(java.lang.Object inMsg,
                                Consumer.MessageObjectType outputType,
                                long timeout)
                                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.
outputType - - value to be returned of type.
timeout -
Returns:
object of type outputType
Throws:
MessageException


Copyright © 2006-2009. All Rights Reserved.