JBoss.orgCommunity Documentation
This chapter presents some examples using the protocol notation.
This example shows how a Buyer role and Seller role may interact in an ordering process.
protocol BuyerSeller (role Buyer) {
Buyer introduces Seller;
Order from Buyer to Seller;
choice at Seller {
Invoice from Seller to Buyer;
} or {
Rejected from Seller to Buyer;
}
}This example shows how a Client role performs a credit check against a CreditAgency role.
protocol CreditCheck (role Client) {
Client introduces CreditAgency;
CheckCredit from Client to CreditAgency;
choice at CreditAgency {
CreditOk from CreditAgency to Client;
} or {
NoCredit from CreditAgency to Client;
}
}This example shows how a protocol can be defined that 'implements' the previous two protocol examples.
protocol BuyerSellerCreditCheck (role Buyer) {
Buyer introduces Seller;
Order from Buyer to Seller;
Seller introduces CreditAgency;
CheckCredit from Seller to CreditAgency;
choice at CreditAgency {
CreditOk from CreditAgency to Seller;
Invoice from Seller to Buyer;
} or {
NoCredit from CreditAgency to Seller;
Rejected from Seller to Buyer;
}
}