Example #1
0
            public static void Handle(IClientMessage clientMessage, HandleMember handleMember,
                                      HandleMemberSet handleMemberSet, HandleMemberAttributeChange handleMemberAttributeChange)
            {
                var messageType = clientMessage.GetMessageType();

                if (messageType == EventMessageConst.EventMember)
                {
                    IMember member = null;
                    member = MemberCodec.Decode(clientMessage);
                    int eventType;
                    eventType = clientMessage.GetInt();
                    handleMember(member, eventType);
                    return;
                }
                if (messageType == EventMessageConst.EventMemberSet)
                {
                    IList <IMember> members      = null;
                    var             members_size = clientMessage.GetInt();
                    members = new List <IMember>();
                    for (var members_index = 0; members_index < members_size; members_index++)
                    {
                        IMember members_item;
                        members_item = MemberCodec.Decode(clientMessage);
                        members.Add(members_item);
                    }
                    handleMemberSet(members);
                    return;
                }
                if (messageType == EventMessageConst.EventMemberAttributeChange)
                {
                    string uuid = null;
                    uuid = clientMessage.GetStringUtf8();
                    string key = null;
                    key = clientMessage.GetStringUtf8();
                    int operationType;
                    operationType = clientMessage.GetInt();
                    string value        = null;
                    var    value_isNull = clientMessage.GetBoolean();
                    if (!value_isNull)
                    {
                        value = clientMessage.GetStringUtf8();
                    }
                    handleMemberAttributeChange(uuid, key, operationType, value);
                    return;
                }
                Logger.GetLogger(typeof(AbstractEventHandler))
                .Warning("Unknown message type received on event handler :" + clientMessage.GetMessageType());
            }
 public static void Handle(IClientMessage clientMessage, HandleMember handleMember,
     HandleMemberSet handleMemberSet, HandleMemberAttributeChange handleMemberAttributeChange)
 {
     var messageType = clientMessage.GetMessageType();
     if (messageType == EventMessageConst.EventMember)
     {
         IMember member = null;
         member = MemberCodec.Decode(clientMessage);
         int eventType;
         eventType = clientMessage.GetInt();
         handleMember(member, eventType);
         return;
     }
     if (messageType == EventMessageConst.EventMemberSet)
     {
         IList<IMember> members = null;
         var members_size = clientMessage.GetInt();
         members = new List<IMember>();
         for (var members_index = 0; members_index < members_size; members_index++)
         {
             IMember members_item;
             members_item = MemberCodec.Decode(clientMessage);
             members.Add(members_item);
         }
         handleMemberSet(members);
         return;
     }
     if (messageType == EventMessageConst.EventMemberAttributeChange)
     {
         string uuid = null;
         uuid = clientMessage.GetStringUtf8();
         string key = null;
         key = clientMessage.GetStringUtf8();
         int operationType;
         operationType = clientMessage.GetInt();
         string value = null;
         var value_isNull = clientMessage.GetBoolean();
         if (!value_isNull)
         {
             value = clientMessage.GetStringUtf8();
         }
         handleMemberAttributeChange(uuid, key, operationType, value);
         return;
     }
     Logger.GetLogger(typeof (AbstractEventHandler))
         .Warning("Unknown message type received on event handler :" + clientMessage.GetMessageType());
 }
Example #3
0
            public static void Handle(IClientMessage clientMessage, HandleMember handleMember,
                                      HandleMemberList handleMemberList, HandleMemberAttributeChange handleMemberAttributeChange)
            {
                var messageType = clientMessage.GetMessageType();

                if (messageType == EventMessageConst.EventMember)
                {
                    var member    = MemberCodec.Decode(clientMessage);
                    var eventType = clientMessage.GetInt();
                    handleMember(member, eventType);
                    return;
                }
                if (messageType == EventMessageConst.EventMemberList)
                {
                    var members     = new List <Core.IMember>();
                    var membersSize = clientMessage.GetInt();
                    for (var membersIndex = 0; membersIndex < membersSize; membersIndex++)
                    {
                        var membersItem = MemberCodec.Decode(clientMessage);
                        members.Add(membersItem);
                    }
                    handleMemberList(members);
                    return;
                }
                if (messageType == EventMessageConst.EventMemberAttributeChange)
                {
                    var    uuid          = clientMessage.GetStringUtf8();
                    var    key           = clientMessage.GetStringUtf8();
                    var    operationType = clientMessage.GetInt();
                    string value         = null;
                    var    valueIsNull   = clientMessage.GetBoolean();
                    if (!valueIsNull)
                    {
                        value = clientMessage.GetStringUtf8();
                    }
                    handleMemberAttributeChange(uuid, key, operationType, value);
                    return;
                }
                Hazelcast.Logging.Logger.GetLogger(typeof(AbstractEventHandler))
                .Warning("Unknown message type received on event handler :" + clientMessage.GetMessageType());
            }