From a quick read, this matches my understanding of the spec.  I'll take
another more detailed look at the spec words when I resurface from my
current debugging-fest :-)

  Simon

Simon Laws wrote:

I've been having a little trouble interpreting what is meant by stateful
callbacks as defined by the various SCA specifications (in particular the
assembly
spec and the Java Annotations and APIS spec section 1.6.7.2). Here is what I
think it means. This is my interpretation and I welcome any other views.

Conversational sematics ensure that messages arriving at a target component,
which are part of the same conversation (as identified by convesationId),
are all
consumed by the same target component instance.

Callback sematics are about defining a two way relationship between a source
component and a target component. When a source component calls a target
component the target component can send messages asynchronously back to the
source component using the callback interface.

When bringing to two together we need to say something about what we expect
the behaviour of both the source and target components to be.

Consider these interfaces.

@Remotable
interface Source {
  ...
}

@Remotable
@Conversational
interface Callback {
  ...
}

@Remoteable
@Conversational
@Callback(Callback.class)
interface Target {
  ...
}

Consider these component implementations. Note, I am presenting scoping
options not suggesting that there is a new syntax for mixing scopes.

@Scope("CONVERSATION") // option - StatefulSource
or
@Scope("STATELESS")    // option - StatelessSource  (ignoring other scopes
for the moment)
class SourceImpl implements Source, Callback {
  ...
}

@Scope("CONVERSATION") // option - StatefulTarget
or
@Scope("STATELESS")    // option - StatelessTarget (ignoring other scopes
for the moment)
class TargetImpl implements Target {
   @ConversationID
   protected String conversationId;

   @Callback
   protected Callback callback;

   ...
}

Here is what I believe the options mean starting from the bottom.

StatelessTarget - a new target component instance is created when each
message arrives and conversationId and callback are populated each time
StatefulTarget  - a single target component instance is created for each
conversation and lasts for the length of the conversation. conversationId
and callback are set once
                       for a conversation when the conversation begins
StatelessSource - messages sent from a source component instance give rise
to asynchronous (they may arrive at any time) messages to the callback
interface
                 of a separate source component instance created
specifically to receive the message.  Message correlation is performed
manually based on
                 a callbackId
StatefulSource  - messages sent from a source component instance give rise
to asynchronous (they may arrive at any time) messages to the callback
interface
                 of same source component instance that sent the original
message.

So for Stateful components;

- With respect to the anticipated reception of messages across the Callback
interface, conversations at the source component end are started when a
 message is sent, I.e. this is when the existing component instance is
associated with the conversation id for future reference.
- Conversations at the target component end are started when the first
conversation message arrives. At this point a new instance is created to
process the incoming message and
 subsequent messages that are part of the conversation.

Is this the correct interpretation of the progamming model?

Simon




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to