예제 #1
0
        private Message SavePendingContract(Message message)
        {
            Contract contract = null;

            if (JsonExt.TryParse(message.Content, out contract))
            {
                Console.WriteLine("Saving pending contract");
                _process.AddPendingContract(contract);
            }
            return(new Message());
        }
예제 #2
0
        public void AddPendingParticipant(Participant participant)
        {
            this.UpdateSchema();

            this.Contract.DatabaseName     = this.Name;
            this.Contract.DatabaseId       = this.Id;
            this.Contract.DatabaseLocation = _process.GetLocation();
            this.Contract.DatabaseSchema   = this.Schema;

            var contractMessage = new Message(
                destination: participant.Location,
                origin: _process.GetLocation(),
                messageContent: JsonExt.SeralizeContract(this.Contract),
                messageAction: MessageDataAction.Contract.Save_Pending_Contract,
                messageType: MessageType.Data
                );

            //TO DO: Should this wait if the send is successful or not before adding participant?
            _process.Network.SendMessage(contractMessage);
            _participantManager.AddPendingParticipant(participant);
        }