JBoss.orgCommunity Documentation

Scribble

Protocol Guide


Scribble is a simple text based language for describing interactions between multiple parties in the form of a Protocol.

"Scribbling is necessary for architects, either physical or computing, since all great ideas of architectural construction come from that unconscious moment, when you do not realise what it is, when there is no concrete shape, only a whisper which is not a whisper, an image which is not an image, somehow it starts to urge you in your mind, in so small a voice but how persistent it is, at that point you start scribbling" - Kohei Honda 2007

The Protocol notation is intended to provide an abstract description of the communication behaviour, with addtional optional layers being used to describe assertions and other governance related information.

In the world of programming languages, the measure of the simplicity of a language is based on its representation of a simple 'hello world' example. The Scribble Protocol representation of such an example would be:

The notation will be explained in more detail in this guide, but basically the protocol is named 'HelloWorld', and describes the communication behaviour between two participants (or parties). A single interaction has been defined, sending a message of type 'Hello' from participant 'You' to participant 'World'.

In the following chapter we will explore the main constructs of the protocol notation. Then we will explore a range of examples, before concluding with a brief overview of some more advanced constructs that are still under development.

The protocol definition is comprised of a:

The syntax for the process definition is:

The namespace can define a user specific hierarchy to organise protocol definitions. The separate parts of the hierarchy can be specified separated by '.'.

The import statement enables fully qualified types to be referenced within the protocol definition based on their local name. For example, the type my.scribble.type.Order could be imported into a protocol definition, and subsequently referenced based only on the local part of the fully qualified name, i.e. Order.

The types can represent any scribble type that needs to be referenced. This could be message types, exchanged as part of an interaction, or other protocol definitions.

The final part of the protocol definition is the declaration of the protocol unit itself. This defines the name of the protocol and whether it is located at a particular participant.

The following represents a 'global' protocol example:

The namespace can be any user defined scope. In this case it is my.scribble.examples.

This example shows two variations of the import statement. The first importing a single type based on its fully qualified name. The second importing a particular type, and also identifying a URL where more details about the type can be found.

The global protocol is then defined, named as PurchaseGoods. This is a global protocol because it does not specify a particular participant at which the definition is located.

A local protocol variation would be:

This local representation of the protocol defines the behaviour from the Buyer participant's perspective. That is why the participants declared within the protocol unit only include the Seller, as this it the participant with which the Buyer is going to communicate.

This chapter describes constructs that are still work in progress.

This means that they may be included in the tool support for the notation, but may change in a future version. So any use of these constructs are not guaranteed to be supported in future versions of the tools.

The concept of a 'global escape' is to support the abrupt termination of a set of activities based on the occurance of a situation. The situation may result from an interaction, or an internal condition within one of the co-operating participants, which subsequently results in the other parties being informed to 'escape' from their normal activities.

There can be zero or more catch blocks, and zero or more interupt blocks.

The catch block represents a set of activities triggered based on an exception being raised at local participant (see the raise activity. If a located participant is specified, then this will be the participant at which the exception will be raised - and the initiator participant for any subsequent activity performed in the block. If more than one participant is specified, then each of these participants will need to be synchronized in their decision to escape from the try block.

The interrupt block represents a set of activities triggered by some internal condition. If a located participant is specified, then this will be the participant at which the interrupt will occur. As with the catch block, this will also be the initiator participant for any subsequent activity performed in the block. If more than one participant is specified, then each of these participants will need to be synchronized in their decision to escape from the try block.

The following example shows how internal decisions within the Buyer can be used to escape from the repetition of receiving quotes from the Seller, and result in either accept or cancel quote messages being sent to the Seller.

The following variation repetitively gets a quote from the Supplier until the Buyer decides to escape from the normal block by raising a Quit type that is caught at the Buyer and used to send a CancelQuote message to the Seller.