[Opa] Network to transit information of more than one type

Frederic Ye frederic.ye at mlstate.com
Tue Apr 17 12:47:30 UTC 2012


You just have to say : 

type message = trade or order

And then when you receive a message, you match the record :

function user_update(message x){
  match (x) {
  case ~{ref_no, account, buy_sell, instrument, attributes}: do_this()
  case ~{quantity, security, amount}: do_that()
  }
}

On Apr 17, 2012, at 1:30 PM, amulya rattan wrote:

> What if I want to transfer these two types of messages in my network:
> 
> 1. type trade = {int ref_no, int account,int buy_sell, string instrument, string attributes}
> 2. type order = {int quantity, String security, int amount}
> 
> I can't extend one type of message from another there. Hope this makes my point clear.
> 
> ~Amulya
> 
> On Tue, Apr 17, 2012 at 7:15 AM, Frederic Ye <frederic.ye at mlstate.com> wrote:
> You can easily extend the message type :
> 
> type stopNetwork = { string error, string code }
> 
> type message = {string author, string text} or stopNetwork
> 
> On Apr 17, 2012, at 1:12 PM, amulya rattan wrote:
> 
> > All,
> >
> > Below statement creates a cloud network of the type of a network that transits information of type message. Is there a way to create a network that can transit different types of messages? For e.g. I want to have an additional type that I want to transmit through the network: type stopNetwork = { string error, string code }. Any suggestions?
> >
> >
> > room = Network.network(message) (Network.cloud("room"))
> > _______________________________________________
> > Opa mailing list
> > Opa at lists.owasp.org
> > https://lists.owasp.org/mailman/listinfo/opa
> 
> Frederic Ye.
> 
> 

Frederic Ye.



More information about the Opa mailing list