Commit 9cdeea93 authored by mohammad.salama's avatar mohammad.salama

GRPC Contracts Edited, Scheduled Added, With Storing in DataBase MongoDB, All Workking Fine

parent 030bdf6f
......@@ -85,7 +85,27 @@
"ProjectGuid": "4239ec44-4415-4369-8da3-809610735e98",
"DisplayName": "TestMongoDBValidator",
"ColorIndex": 15
},
"ea05977f-a221-49af-99ea-2086c63e8fb1": {
"ProjectGuid": "ea05977f-a221-49af-99ea-2086c63e8fb1",
"DisplayName": "MessagesConsumer",
"ColorIndex": 0
},
"e79d172b-80db-4396-ae93-461a9ab3eaf1": {
"ProjectGuid": "e79d172b-80db-4396-ae93-461a9ab3eaf1",
"DisplayName": "ScheduledMessagesHandler",
"ColorIndex": 1
},
"af47ce2a-6fdd-4315-b8fe-1470a1909547": {
"ProjectGuid": "af47ce2a-6fdd-4315-b8fe-1470a1909547",
"DisplayName": "ScheduledMessagesHandler",
"ColorIndex": 2
},
"62d17724-6487-4586-9f2f-c2c0175280a5": {
"ProjectGuid": "62d17724-6487-4586-9f2f-c2c0175280a5",
"DisplayName": "ScheduledMessagesHandler",
"ColorIndex": 3
}
},
"NextColorIndex": 0
"NextColorIndex": 4
}
\ No newline at end of file
......@@ -12,6 +12,11 @@ message Message2 {
int32 localPriority = 5;
string text = 6;
string tag = 7;
int32 year = 8;
int32 month = 9;
int32 day = 10;
int32 hour = 11;
int32 minute = 12;
}
......
......@@ -12,6 +12,11 @@ message Message {
int32 localPriority = 5;
string text = 6;
string tag = 7;
int32 year = 8;
int32 month = 9;
int32 day = 10;
int32 hour = 11;
int32 minute = 12;
}
......
......@@ -11,7 +11,12 @@ service Validate {
message MessageMetaData {
string clientID = 1;
string apiKey = 2;
string tag = 3;
string tag = 3;
int32 year = 4;
int32 month = 5;
int32 day = 6;
int32 hour = 7;
int32 minute = 8;
}
message ValidatorReply {
......
......@@ -24,18 +24,19 @@ namespace GrpcMessageNode {
static SchemaReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIoEBCgdNZXNzYWdl",
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIskBCgdNZXNzYWdl",
"EhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVtc2dJZBgD",
"IAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9yaXR5GAUg",
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJIjcKD0Fja25vd2xlZGdl",
"bWVudBIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkcK",
"BFNlbmQSPwoLU2VuZE1lc3NhZ2USEy5UcmFubWl0dGVyLk1lc3NhZ2UaGy5U",
"cmFubWl0dGVyLkFja25vd2xlZGdlbWVudEISqgIPR3JwY01lc3NhZ2VOb2Rl",
"YgZwcm90bzM="));
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJEgwKBHllYXIYCCABKAUS",
"DQoFbW9udGgYCSABKAUSCwoDZGF5GAogASgFEgwKBGhvdXIYCyABKAUSDgoG",
"bWludXRlGAwgASgFIjcKD0Fja25vd2xlZGdlbWVudBIRCglyZXBseUNvZGUY",
"ASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkcKBFNlbmQSPwoLU2VuZE1lc3Nh",
"Z2USEy5UcmFubWl0dGVyLk1lc3NhZ2UaGy5UcmFubWl0dGVyLkFja25vd2xl",
"ZGdlbWVudEISqgIPR3JwY01lc3NhZ2VOb2RlYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.Message), global::GrpcMessageNode.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.Message), global::GrpcMessageNode.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag", "Year", "Month", "Day", "Hour", "Minute" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.Acknowledgement), global::GrpcMessageNode.Acknowledgement.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
}));
}
......@@ -85,6 +86,11 @@ namespace GrpcMessageNode {
localPriority_ = other.localPriority_;
text_ = other.text_;
tag_ = other.tag_;
year_ = other.year_;
month_ = other.month_;
day_ = other.day_;
hour_ = other.hour_;
minute_ = other.minute_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
......@@ -178,6 +184,66 @@ namespace GrpcMessageNode {
}
}
/// <summary>Field number for the "year" field.</summary>
public const int YearFieldNumber = 8;
private int year_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Year {
get { return year_; }
set {
year_ = value;
}
}
/// <summary>Field number for the "month" field.</summary>
public const int MonthFieldNumber = 9;
private int month_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Month {
get { return month_; }
set {
month_ = value;
}
}
/// <summary>Field number for the "day" field.</summary>
public const int DayFieldNumber = 10;
private int day_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Day {
get { return day_; }
set {
day_ = value;
}
}
/// <summary>Field number for the "hour" field.</summary>
public const int HourFieldNumber = 11;
private int hour_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Hour {
get { return hour_; }
set {
hour_ = value;
}
}
/// <summary>Field number for the "minute" field.</summary>
public const int MinuteFieldNumber = 12;
private int minute_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Minute {
get { return minute_; }
set {
minute_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
......@@ -200,6 +266,11 @@ namespace GrpcMessageNode {
if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
if (Year != other.Year) return false;
if (Month != other.Month) return false;
if (Day != other.Day) return false;
if (Hour != other.Hour) return false;
if (Minute != other.Minute) return false;
return Equals(_unknownFields, other._unknownFields);
}
......@@ -214,6 +285,11 @@ namespace GrpcMessageNode {
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (Year != 0) hash ^= Year.GetHashCode();
if (Month != 0) hash ^= Month.GetHashCode();
if (Day != 0) hash ^= Day.GetHashCode();
if (Hour != 0) hash ^= Hour.GetHashCode();
if (Minute != 0) hash ^= Minute.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
......@@ -260,6 +336,26 @@ namespace GrpcMessageNode {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
......@@ -298,6 +394,26 @@ namespace GrpcMessageNode {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
......@@ -329,6 +445,21 @@ namespace GrpcMessageNode {
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (Year != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Year);
}
if (Month != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Month);
}
if (Day != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Day);
}
if (Hour != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Hour);
}
if (Minute != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Minute);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
......@@ -362,6 +493,21 @@ namespace GrpcMessageNode {
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
if (other.Year != 0) {
Year = other.Year;
}
if (other.Month != 0) {
Month = other.Month;
}
if (other.Day != 0) {
Day = other.Day;
}
if (other.Hour != 0) {
Hour = other.Hour;
}
if (other.Minute != 0) {
Minute = other.Minute;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
......@@ -405,6 +551,26 @@ namespace GrpcMessageNode {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
#endif
......@@ -448,6 +614,26 @@ namespace GrpcMessageNode {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
}
......
......@@ -24,18 +24,20 @@ namespace GrpcMessageNode {
static SchemaQueueReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChlQcm90b3Mvc2NoZW1hLXF1ZXVlLnByb3RvEgpUcmFubWl0dGVyIoIBCghN",
"ChlQcm90b3Mvc2NoZW1hLXF1ZXVlLnByb3RvEgpUcmFubWl0dGVyIsoBCghN",
"ZXNzYWdlMhIQCghjbGllbnRJRBgBIAEoCRIOCgZhcGlLZXkYAiABKAkSDQoF",
"bXNnSWQYAyABKAkSEwoLcGhvbmVOdW1iZXIYBCABKAkSFQoNbG9jYWxQcmlv",
"cml0eRgFIAEoBRIMCgR0ZXh0GAYgASgJEgsKA3RhZxgHIAEoCSI4ChBBY2tu",
"b3dsZWRnZW1lbnQyEhEKCXJlcGx5Q29kZRgBIAEoCRIRCglyZXF1ZXN0SUQY",
"AiABKAkySwoFUXVldWUSQgoMUXVldWVNZXNzYWdlEhQuVHJhbm1pdHRlci5N",
"ZXNzYWdlMhocLlRyYW5taXR0ZXIuQWNrbm93bGVkZ2VtZW50MkISqgIPR3Jw",
"Y01lc3NhZ2VOb2RlYgZwcm90bzM="));
"cml0eRgFIAEoBRIMCgR0ZXh0GAYgASgJEgsKA3RhZxgHIAEoCRIMCgR5ZWFy",
"GAggASgFEg0KBW1vbnRoGAkgASgFEgsKA2RheRgKIAEoBRIMCgRob3VyGAsg",
"ASgFEg4KBm1pbnV0ZRgMIAEoBSI4ChBBY2tub3dsZWRnZW1lbnQyEhEKCXJl",
"cGx5Q29kZRgBIAEoCRIRCglyZXF1ZXN0SUQYAiABKAkySwoFUXVldWUSQgoM",
"UXVldWVNZXNzYWdlEhQuVHJhbm1pdHRlci5NZXNzYWdlMhocLlRyYW5taXR0",
"ZXIuQWNrbm93bGVkZ2VtZW50MkISqgIPR3JwY01lc3NhZ2VOb2RlYgZwcm90",
"bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.Message2), global::GrpcMessageNode.Message2.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.Message2), global::GrpcMessageNode.Message2.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag", "Year", "Month", "Day", "Hour", "Minute" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.Acknowledgement2), global::GrpcMessageNode.Acknowledgement2.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
}));
}
......@@ -85,6 +87,11 @@ namespace GrpcMessageNode {
localPriority_ = other.localPriority_;
text_ = other.text_;
tag_ = other.tag_;
year_ = other.year_;
month_ = other.month_;
day_ = other.day_;
hour_ = other.hour_;
minute_ = other.minute_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
......@@ -178,6 +185,66 @@ namespace GrpcMessageNode {
}
}
/// <summary>Field number for the "year" field.</summary>
public const int YearFieldNumber = 8;
private int year_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Year {
get { return year_; }
set {
year_ = value;
}
}
/// <summary>Field number for the "month" field.</summary>
public const int MonthFieldNumber = 9;
private int month_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Month {
get { return month_; }
set {
month_ = value;
}
}
/// <summary>Field number for the "day" field.</summary>
public const int DayFieldNumber = 10;
private int day_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Day {
get { return day_; }
set {
day_ = value;
}
}
/// <summary>Field number for the "hour" field.</summary>
public const int HourFieldNumber = 11;
private int hour_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Hour {
get { return hour_; }
set {
hour_ = value;
}
}
/// <summary>Field number for the "minute" field.</summary>
public const int MinuteFieldNumber = 12;
private int minute_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Minute {
get { return minute_; }
set {
minute_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
......@@ -200,6 +267,11 @@ namespace GrpcMessageNode {
if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
if (Year != other.Year) return false;
if (Month != other.Month) return false;
if (Day != other.Day) return false;
if (Hour != other.Hour) return false;
if (Minute != other.Minute) return false;
return Equals(_unknownFields, other._unknownFields);
}
......@@ -214,6 +286,11 @@ namespace GrpcMessageNode {
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (Year != 0) hash ^= Year.GetHashCode();
if (Month != 0) hash ^= Month.GetHashCode();
if (Day != 0) hash ^= Day.GetHashCode();
if (Hour != 0) hash ^= Hour.GetHashCode();
if (Minute != 0) hash ^= Minute.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
......@@ -260,6 +337,26 @@ namespace GrpcMessageNode {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
......@@ -298,6 +395,26 @@ namespace GrpcMessageNode {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
......@@ -329,6 +446,21 @@ namespace GrpcMessageNode {
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (Year != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Year);
}
if (Month != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Month);
}
if (Day != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Day);
}
if (Hour != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Hour);
}
if (Minute != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Minute);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
......@@ -362,6 +494,21 @@ namespace GrpcMessageNode {
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
if (other.Year != 0) {
Year = other.Year;
}
if (other.Month != 0) {
Month = other.Month;
}
if (other.Day != 0) {
Day = other.Day;
}
if (other.Hour != 0) {
Hour = other.Hour;
}
if (other.Minute != 0) {
Minute = other.Minute;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
......@@ -405,6 +552,26 @@ namespace GrpcMessageNode {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
#endif
......@@ -448,6 +615,26 @@ namespace GrpcMessageNode {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
}
......
......@@ -24,17 +24,18 @@ namespace GrpcMessageNode {
static ValidatorReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChZQcm90b3MvdmFsaWRhdG9yLnByb3RvEglWYWxpZGF0b3IiQAoPTWVzc2Fn",
"ZU1ldGFEYXRhEhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRIL",
"CgN0YWcYAyABKAkiPAoOVmFsaWRhdG9yUmVwbHkSEQoJcmVwbHlDb2RlGAEg",
"ASgJEhcKD2FjY291bnRQcmlvcml0eRgCIAEoBTJUCghWYWxpZGF0ZRJICg9W",
"YWxpZGF0ZU1lc3NhZ2USGi5WYWxpZGF0b3IuTWVzc2FnZU1ldGFEYXRhGhku",
"VmFsaWRhdG9yLlZhbGlkYXRvclJlcGx5QhKqAg9HcnBjTWVzc2FnZU5vZGVi",
"BnByb3RvMw=="));
"ChZQcm90b3MvdmFsaWRhdG9yLnByb3RvEglWYWxpZGF0b3IiiAEKD01lc3Nh",
"Z2VNZXRhRGF0YRIQCghjbGllbnRJRBgBIAEoCRIOCgZhcGlLZXkYAiABKAkS",
"CwoDdGFnGAMgASgJEgwKBHllYXIYBCABKAUSDQoFbW9udGgYBSABKAUSCwoD",
"ZGF5GAYgASgFEgwKBGhvdXIYByABKAUSDgoGbWludXRlGAggASgFIjwKDlZh",
"bGlkYXRvclJlcGx5EhEKCXJlcGx5Q29kZRgBIAEoCRIXCg9hY2NvdW50UHJp",
"b3JpdHkYAiABKAUyVAoIVmFsaWRhdGUSSAoPVmFsaWRhdGVNZXNzYWdlEhou",
"VmFsaWRhdG9yLk1lc3NhZ2VNZXRhRGF0YRoZLlZhbGlkYXRvci5WYWxpZGF0",
"b3JSZXBseUISqgIPR3JwY01lc3NhZ2VOb2RlYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.MessageMetaData), global::GrpcMessageNode.MessageMetaData.Parser, new[]{ "ClientID", "ApiKey", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.MessageMetaData), global::GrpcMessageNode.MessageMetaData.Parser, new[]{ "ClientID", "ApiKey", "Tag", "Year", "Month", "Day", "Hour", "Minute" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.ValidatorReply), global::GrpcMessageNode.ValidatorReply.Parser, new[]{ "ReplyCode", "AccountPriority" }, null, null, null, null)
}));
}
......@@ -80,6 +81,11 @@ namespace GrpcMessageNode {
clientID_ = other.clientID_;
apiKey_ = other.apiKey_;
tag_ = other.tag_;
year_ = other.year_;
month_ = other.month_;
day_ = other.day_;
hour_ = other.hour_;
minute_ = other.minute_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
......@@ -125,6 +131,66 @@ namespace GrpcMessageNode {
}
}
/// <summary>Field number for the "year" field.</summary>
public const int YearFieldNumber = 4;
private int year_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Year {
get { return year_; }
set {
year_ = value;
}
}
/// <summary>Field number for the "month" field.</summary>
public const int MonthFieldNumber = 5;
private int month_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Month {
get { return month_; }
set {
month_ = value;
}
}
/// <summary>Field number for the "day" field.</summary>
public const int DayFieldNumber = 6;
private int day_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Day {
get { return day_; }
set {
day_ = value;
}
}
/// <summary>Field number for the "hour" field.</summary>
public const int HourFieldNumber = 7;
private int hour_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Hour {
get { return hour_; }
set {
hour_ = value;
}
}
/// <summary>Field number for the "minute" field.</summary>
public const int MinuteFieldNumber = 8;
private int minute_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Minute {
get { return minute_; }
set {
minute_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
......@@ -143,6 +209,11 @@ namespace GrpcMessageNode {
if (ClientID != other.ClientID) return false;
if (ApiKey != other.ApiKey) return false;
if (Tag != other.Tag) return false;
if (Year != other.Year) return false;
if (Month != other.Month) return false;
if (Day != other.Day) return false;
if (Hour != other.Hour) return false;
if (Minute != other.Minute) return false;
return Equals(_unknownFields, other._unknownFields);
}
......@@ -153,6 +224,11 @@ namespace GrpcMessageNode {
if (ClientID.Length != 0) hash ^= ClientID.GetHashCode();
if (ApiKey.Length != 0) hash ^= ApiKey.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (Year != 0) hash ^= Year.GetHashCode();
if (Month != 0) hash ^= Month.GetHashCode();
if (Day != 0) hash ^= Day.GetHashCode();
if (Hour != 0) hash ^= Hour.GetHashCode();
if (Minute != 0) hash ^= Minute.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
......@@ -183,6 +259,26 @@ namespace GrpcMessageNode {
output.WriteRawTag(26);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(32);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(40);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(48);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(56);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(64);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
......@@ -205,6 +301,26 @@ namespace GrpcMessageNode {
output.WriteRawTag(26);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(32);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(40);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(48);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(56);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(64);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
......@@ -224,6 +340,21 @@ namespace GrpcMessageNode {
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (Year != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Year);
}
if (Month != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Month);
}
if (Day != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Day);
}
if (Hour != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Hour);
}
if (Minute != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Minute);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
......@@ -245,6 +376,21 @@ namespace GrpcMessageNode {
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
if (other.Year != 0) {
Year = other.Year;
}
if (other.Month != 0) {
Month = other.Month;
}
if (other.Day != 0) {
Day = other.Day;
}
if (other.Hour != 0) {
Hour = other.Hour;
}
if (other.Minute != 0) {
Minute = other.Minute;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
......@@ -272,6 +418,26 @@ namespace GrpcMessageNode {
Tag = input.ReadString();
break;
}
case 32: {
Year = input.ReadInt32();
break;
}
case 40: {
Month = input.ReadInt32();
break;
}
case 48: {
Day = input.ReadInt32();
break;
}
case 56: {
Hour = input.ReadInt32();
break;
}
case 64: {
Minute = input.ReadInt32();
break;
}
}
}
#endif
......@@ -299,6 +465,26 @@ namespace GrpcMessageNode {
Tag = input.ReadString();
break;
}
case 32: {
Year = input.ReadInt32();
break;
}
case 40: {
Month = input.ReadInt32();
break;
}
case 48: {
Day = input.ReadInt32();
break;
}
case 56: {
Hour = input.ReadInt32();
break;
}
case 64: {
Minute = input.ReadInt32();
break;
}
}
}
}
......
......@@ -15,11 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HTTPMessageGenerator", "HTT
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Validator", "Validator\Validator.csproj", "{D2C3ADDD-BA47-473C-A761-1CE5B1EE6407}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleStreamConsumerTest", "SimpleStreamConsumerTest\SimpleStreamConsumerTest.csproj", "{8F51B680-F3B6-4892-B854-2E2AF840CD71}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PriorityStream", "PriorityStream\PriorityStream.csproj", "{4F286608-7770-4511-BF37-2B94F5351D42}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MessagesConsumer", "MessagesConsumer\MessagesConsumer.csproj", "{EA05977F-A221-49AF-99EA-2086C63E8FB1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessagesConsumer", "MessagesConsumer\MessagesConsumer.csproj", "{EA05977F-A221-49AF-99EA-2086C63E8FB1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScheduledMessagesHandler", "ScheduledMessagesHandler\ScheduledMessagesHandler.csproj", "{62D17724-6487-4586-9F2F-C2C0175280A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -51,10 +51,6 @@ Global
{D2C3ADDD-BA47-473C-A761-1CE5B1EE6407}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2C3ADDD-BA47-473C-A761-1CE5B1EE6407}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2C3ADDD-BA47-473C-A761-1CE5B1EE6407}.Release|Any CPU.Build.0 = Release|Any CPU
{8F51B680-F3B6-4892-B854-2E2AF840CD71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F51B680-F3B6-4892-B854-2E2AF840CD71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F51B680-F3B6-4892-B854-2E2AF840CD71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F51B680-F3B6-4892-B854-2E2AF840CD71}.Release|Any CPU.Build.0 = Release|Any CPU
{4F286608-7770-4511-BF37-2B94F5351D42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F286608-7770-4511-BF37-2B94F5351D42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F286608-7770-4511-BF37-2B94F5351D42}.Release|Any CPU.ActiveCfg = Release|Any CPU
......@@ -63,6 +59,10 @@ Global
{EA05977F-A221-49AF-99EA-2086C63E8FB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA05977F-A221-49AF-99EA-2086C63E8FB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA05977F-A221-49AF-99EA-2086C63E8FB1}.Release|Any CPU.Build.0 = Release|Any CPU
{62D17724-6487-4586-9F2F-C2C0175280A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62D17724-6487-4586-9F2F-C2C0175280A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62D17724-6487-4586-9F2F-C2C0175280A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62D17724-6487-4586-9F2F-C2C0175280A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -15,5 +15,10 @@ namespace HTTPMessageGenerator
public int localPriority { get; set; }
public string? text { get; set; }
public string? tag { get; set; }
public int year { get; set; }
public int month { get; set; }
public int day { get; set; }
public int hour { get; set; }
public int minute { get; set; }
}
}
......@@ -12,6 +12,11 @@ message Message {
int32 localPriority = 5;
string text = 6;
string tag = 7;
int32 year = 8;
int32 month = 9;
int32 day = 10;
int32 hour = 11;
int32 minute = 12;
}
......
......@@ -24,18 +24,19 @@ namespace HTTPMessageGenerator {
static SchemaReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIoEBCgdNZXNzYWdl",
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIskBCgdNZXNzYWdl",
"EhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVtc2dJZBgD",
"IAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9yaXR5GAUg",
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJIjcKD0Fja25vd2xlZGdl",
"bWVudBIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkkK",
"BVF1ZXVlEkAKDFF1ZXVlTWVzc2FnZRITLlRyYW5taXR0ZXIuTWVzc2FnZRob",
"LlRyYW5taXR0ZXIuQWNrbm93bGVkZ2VtZW50QheqAhRIVFRQTWVzc2FnZUdl",
"bmVyYXRvcmIGcHJvdG8z"));
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJEgwKBHllYXIYCCABKAUS",
"DQoFbW9udGgYCSABKAUSCwoDZGF5GAogASgFEgwKBGhvdXIYCyABKAUSDgoG",
"bWludXRlGAwgASgFIjcKD0Fja25vd2xlZGdlbWVudBIRCglyZXBseUNvZGUY",
"ASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkkKBVF1ZXVlEkAKDFF1ZXVlTWVz",
"c2FnZRITLlRyYW5taXR0ZXIuTWVzc2FnZRobLlRyYW5taXR0ZXIuQWNrbm93",
"bGVkZ2VtZW50QheqAhRIVFRQTWVzc2FnZUdlbmVyYXRvcmIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::HTTPMessageGenerator.Message), global::HTTPMessageGenerator.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::HTTPMessageGenerator.Message), global::HTTPMessageGenerator.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag", "Year", "Month", "Day", "Hour", "Minute" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::HTTPMessageGenerator.Acknowledgement), global::HTTPMessageGenerator.Acknowledgement.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
}));
}
......@@ -85,6 +86,11 @@ namespace HTTPMessageGenerator {
localPriority_ = other.localPriority_;
text_ = other.text_;
tag_ = other.tag_;
year_ = other.year_;
month_ = other.month_;
day_ = other.day_;
hour_ = other.hour_;
minute_ = other.minute_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
......@@ -178,6 +184,66 @@ namespace HTTPMessageGenerator {
}
}
/// <summary>Field number for the "year" field.</summary>
public const int YearFieldNumber = 8;
private int year_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Year {
get { return year_; }
set {
year_ = value;
}
}
/// <summary>Field number for the "month" field.</summary>
public const int MonthFieldNumber = 9;
private int month_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Month {
get { return month_; }
set {
month_ = value;
}
}
/// <summary>Field number for the "day" field.</summary>
public const int DayFieldNumber = 10;
private int day_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Day {
get { return day_; }
set {
day_ = value;
}
}
/// <summary>Field number for the "hour" field.</summary>
public const int HourFieldNumber = 11;
private int hour_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Hour {
get { return hour_; }
set {
hour_ = value;
}
}
/// <summary>Field number for the "minute" field.</summary>
public const int MinuteFieldNumber = 12;
private int minute_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Minute {
get { return minute_; }
set {
minute_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
......@@ -200,6 +266,11 @@ namespace HTTPMessageGenerator {
if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
if (Year != other.Year) return false;
if (Month != other.Month) return false;
if (Day != other.Day) return false;
if (Hour != other.Hour) return false;
if (Minute != other.Minute) return false;
return Equals(_unknownFields, other._unknownFields);
}
......@@ -214,6 +285,11 @@ namespace HTTPMessageGenerator {
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (Year != 0) hash ^= Year.GetHashCode();
if (Month != 0) hash ^= Month.GetHashCode();
if (Day != 0) hash ^= Day.GetHashCode();
if (Hour != 0) hash ^= Hour.GetHashCode();
if (Minute != 0) hash ^= Minute.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
......@@ -260,6 +336,26 @@ namespace HTTPMessageGenerator {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
......@@ -298,6 +394,26 @@ namespace HTTPMessageGenerator {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
......@@ -329,6 +445,21 @@ namespace HTTPMessageGenerator {
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (Year != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Year);
}
if (Month != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Month);
}
if (Day != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Day);
}
if (Hour != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Hour);
}
if (Minute != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Minute);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
......@@ -362,6 +493,21 @@ namespace HTTPMessageGenerator {
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
if (other.Year != 0) {
Year = other.Year;
}
if (other.Month != 0) {
Month = other.Month;
}
if (other.Day != 0) {
Day = other.Day;
}
if (other.Hour != 0) {
Hour = other.Hour;
}
if (other.Minute != 0) {
Minute = other.Minute;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
......@@ -405,6 +551,26 @@ namespace HTTPMessageGenerator {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
#endif
......@@ -448,6 +614,26 @@ namespace HTTPMessageGenerator {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
}
......
......@@ -108,6 +108,11 @@ namespace HTTPMessageNode.Controllers
message.ApiKey = messageDTO.apiKey;
message.ClientID = messageDTO.clientID;
message.Tag = messageDTO.tag;
message.Year = messageDTO.year;
message.Month = messageDTO.month;
message.Day = messageDTO.day;
message.Hour = messageDTO.hour;
message.Minute = messageDTO.minute;
return message;
}
......
......@@ -15,5 +15,10 @@ namespace HTTPMessageNode
public int localPriority { get; set; }
public string? text { get; set; }
public string? tag { get; set; }
public int year { get; set; }
public int month { get; set; }
public int day { get; set; }
public int hour { get; set; }
public int minute { get; set; }
}
}
......@@ -12,6 +12,11 @@ message Message {
int32 localPriority = 5;
string text = 6;
string tag = 7;
int32 year = 8;
int32 month = 9;
int32 day = 10;
int32 hour = 11;
int32 minute = 12;
}
......
......@@ -12,6 +12,11 @@ message MessageMetaData {
string clientID = 1;
string apiKey = 2;
string tag = 3;
int32 year = 4;
int32 month = 5;
int32 day = 6;
int32 hour = 7;
int32 minute = 8;
}
message ValidatorReply {
......
......@@ -24,18 +24,19 @@ namespace HTTPMessageNode {
static SchemaReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIoEBCgdNZXNzYWdl",
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIskBCgdNZXNzYWdl",
"EhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVtc2dJZBgD",
"IAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9yaXR5GAUg",
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJIjcKD0Fja25vd2xlZGdl",
"bWVudBIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkkK",
"BVF1ZXVlEkAKDFF1ZXVlTWVzc2FnZRITLlRyYW5taXR0ZXIuTWVzc2FnZRob",
"LlRyYW5taXR0ZXIuQWNrbm93bGVkZ2VtZW50QhKqAg9IVFRQTWVzc2FnZU5v",
"ZGViBnByb3RvMw=="));
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJEgwKBHllYXIYCCABKAUS",
"DQoFbW9udGgYCSABKAUSCwoDZGF5GAogASgFEgwKBGhvdXIYCyABKAUSDgoG",
"bWludXRlGAwgASgFIjcKD0Fja25vd2xlZGdlbWVudBIRCglyZXBseUNvZGUY",
"ASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkkKBVF1ZXVlEkAKDFF1ZXVlTWVz",
"c2FnZRITLlRyYW5taXR0ZXIuTWVzc2FnZRobLlRyYW5taXR0ZXIuQWNrbm93",
"bGVkZ2VtZW50QhKqAg9IVFRQTWVzc2FnZU5vZGViBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::HTTPMessageNode.Message), global::HTTPMessageNode.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::HTTPMessageNode.Message), global::HTTPMessageNode.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag", "Year", "Month", "Day", "Hour", "Minute" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::HTTPMessageNode.Acknowledgement), global::HTTPMessageNode.Acknowledgement.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
}));
}
......@@ -85,6 +86,11 @@ namespace HTTPMessageNode {
localPriority_ = other.localPriority_;
text_ = other.text_;
tag_ = other.tag_;
year_ = other.year_;
month_ = other.month_;
day_ = other.day_;
hour_ = other.hour_;
minute_ = other.minute_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
......@@ -178,6 +184,66 @@ namespace HTTPMessageNode {
}
}
/// <summary>Field number for the "year" field.</summary>
public const int YearFieldNumber = 8;
private int year_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Year {
get { return year_; }
set {
year_ = value;
}
}
/// <summary>Field number for the "month" field.</summary>
public const int MonthFieldNumber = 9;
private int month_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Month {
get { return month_; }
set {
month_ = value;
}
}
/// <summary>Field number for the "day" field.</summary>
public const int DayFieldNumber = 10;
private int day_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Day {
get { return day_; }
set {
day_ = value;
}
}
/// <summary>Field number for the "hour" field.</summary>
public const int HourFieldNumber = 11;
private int hour_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Hour {
get { return hour_; }
set {
hour_ = value;
}
}
/// <summary>Field number for the "minute" field.</summary>
public const int MinuteFieldNumber = 12;
private int minute_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Minute {
get { return minute_; }
set {
minute_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
......@@ -200,6 +266,11 @@ namespace HTTPMessageNode {
if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
if (Year != other.Year) return false;
if (Month != other.Month) return false;
if (Day != other.Day) return false;
if (Hour != other.Hour) return false;
if (Minute != other.Minute) return false;
return Equals(_unknownFields, other._unknownFields);
}
......@@ -214,6 +285,11 @@ namespace HTTPMessageNode {
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (Year != 0) hash ^= Year.GetHashCode();
if (Month != 0) hash ^= Month.GetHashCode();
if (Day != 0) hash ^= Day.GetHashCode();
if (Hour != 0) hash ^= Hour.GetHashCode();
if (Minute != 0) hash ^= Minute.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
......@@ -260,6 +336,26 @@ namespace HTTPMessageNode {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
......@@ -298,6 +394,26 @@ namespace HTTPMessageNode {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
......@@ -329,6 +445,21 @@ namespace HTTPMessageNode {
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (Year != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Year);
}
if (Month != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Month);
}
if (Day != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Day);
}
if (Hour != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Hour);
}
if (Minute != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Minute);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
......@@ -362,6 +493,21 @@ namespace HTTPMessageNode {
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
if (other.Year != 0) {
Year = other.Year;
}
if (other.Month != 0) {
Month = other.Month;
}
if (other.Day != 0) {
Day = other.Day;
}
if (other.Hour != 0) {
Hour = other.Hour;
}
if (other.Minute != 0) {
Minute = other.Minute;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
......@@ -405,6 +551,26 @@ namespace HTTPMessageNode {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
#endif
......@@ -448,6 +614,26 @@ namespace HTTPMessageNode {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
}
......
......@@ -24,17 +24,18 @@ namespace Validator {
static ValidatorReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChZQcm90b3MvdmFsaWRhdG9yLnByb3RvEglWYWxpZGF0b3IiQAoPTWVzc2Fn",
"ZU1ldGFEYXRhEhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRIL",
"CgN0YWcYAyABKAkiPAoOVmFsaWRhdG9yUmVwbHkSEQoJcmVwbHlDb2RlGAEg",
"ASgJEhcKD2FjY291bnRQcmlvcml0eRgCIAEoBTJUCghWYWxpZGF0ZRJICg9W",
"YWxpZGF0ZU1lc3NhZ2USGi5WYWxpZGF0b3IuTWVzc2FnZU1ldGFEYXRhGhku",
"VmFsaWRhdG9yLlZhbGlkYXRvclJlcGx5QgyqAglWYWxpZGF0b3JiBnByb3Rv",
"Mw=="));
"ChZQcm90b3MvdmFsaWRhdG9yLnByb3RvEglWYWxpZGF0b3IiiAEKD01lc3Nh",
"Z2VNZXRhRGF0YRIQCghjbGllbnRJRBgBIAEoCRIOCgZhcGlLZXkYAiABKAkS",
"CwoDdGFnGAMgASgJEgwKBHllYXIYBCABKAUSDQoFbW9udGgYBSABKAUSCwoD",
"ZGF5GAYgASgFEgwKBGhvdXIYByABKAUSDgoGbWludXRlGAggASgFIjwKDlZh",
"bGlkYXRvclJlcGx5EhEKCXJlcGx5Q29kZRgBIAEoCRIXCg9hY2NvdW50UHJp",
"b3JpdHkYAiABKAUyVAoIVmFsaWRhdGUSSAoPVmFsaWRhdGVNZXNzYWdlEhou",
"VmFsaWRhdG9yLk1lc3NhZ2VNZXRhRGF0YRoZLlZhbGlkYXRvci5WYWxpZGF0",
"b3JSZXBseUIMqgIJVmFsaWRhdG9yYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Validator.MessageMetaData), global::Validator.MessageMetaData.Parser, new[]{ "ClientID", "ApiKey", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Validator.MessageMetaData), global::Validator.MessageMetaData.Parser, new[]{ "ClientID", "ApiKey", "Tag", "Year", "Month", "Day", "Hour", "Minute" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Validator.ValidatorReply), global::Validator.ValidatorReply.Parser, new[]{ "ReplyCode", "AccountPriority" }, null, null, null, null)
}));
}
......@@ -80,6 +81,11 @@ namespace Validator {
clientID_ = other.clientID_;
apiKey_ = other.apiKey_;
tag_ = other.tag_;
year_ = other.year_;
month_ = other.month_;
day_ = other.day_;
hour_ = other.hour_;
minute_ = other.minute_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
......@@ -125,6 +131,66 @@ namespace Validator {
}
}
/// <summary>Field number for the "year" field.</summary>
public const int YearFieldNumber = 4;
private int year_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Year {
get { return year_; }
set {
year_ = value;
}
}
/// <summary>Field number for the "month" field.</summary>
public const int MonthFieldNumber = 5;
private int month_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Month {
get { return month_; }
set {
month_ = value;
}
}
/// <summary>Field number for the "day" field.</summary>
public const int DayFieldNumber = 6;
private int day_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Day {
get { return day_; }
set {
day_ = value;
}
}
/// <summary>Field number for the "hour" field.</summary>
public const int HourFieldNumber = 7;
private int hour_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Hour {
get { return hour_; }
set {
hour_ = value;
}
}
/// <summary>Field number for the "minute" field.</summary>
public const int MinuteFieldNumber = 8;
private int minute_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Minute {
get { return minute_; }
set {
minute_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
......@@ -143,6 +209,11 @@ namespace Validator {
if (ClientID != other.ClientID) return false;
if (ApiKey != other.ApiKey) return false;
if (Tag != other.Tag) return false;
if (Year != other.Year) return false;
if (Month != other.Month) return false;
if (Day != other.Day) return false;
if (Hour != other.Hour) return false;
if (Minute != other.Minute) return false;
return Equals(_unknownFields, other._unknownFields);
}
......@@ -153,6 +224,11 @@ namespace Validator {
if (ClientID.Length != 0) hash ^= ClientID.GetHashCode();
if (ApiKey.Length != 0) hash ^= ApiKey.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (Year != 0) hash ^= Year.GetHashCode();
if (Month != 0) hash ^= Month.GetHashCode();
if (Day != 0) hash ^= Day.GetHashCode();
if (Hour != 0) hash ^= Hour.GetHashCode();
if (Minute != 0) hash ^= Minute.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
......@@ -183,6 +259,26 @@ namespace Validator {
output.WriteRawTag(26);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(32);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(40);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(48);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(56);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(64);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
......@@ -205,6 +301,26 @@ namespace Validator {
output.WriteRawTag(26);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(32);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(40);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(48);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(56);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(64);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
......@@ -224,6 +340,21 @@ namespace Validator {
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (Year != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Year);
}
if (Month != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Month);
}
if (Day != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Day);
}
if (Hour != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Hour);
}
if (Minute != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Minute);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
......@@ -245,6 +376,21 @@ namespace Validator {
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
if (other.Year != 0) {
Year = other.Year;
}
if (other.Month != 0) {
Month = other.Month;
}
if (other.Day != 0) {
Day = other.Day;
}
if (other.Hour != 0) {
Hour = other.Hour;
}
if (other.Minute != 0) {
Minute = other.Minute;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
......@@ -272,6 +418,26 @@ namespace Validator {
Tag = input.ReadString();
break;
}
case 32: {
Year = input.ReadInt32();
break;
}
case 40: {
Month = input.ReadInt32();
break;
}
case 48: {
Day = input.ReadInt32();
break;
}
case 56: {
Hour = input.ReadInt32();
break;
}
case 64: {
Minute = input.ReadInt32();
break;
}
}
}
#endif
......@@ -299,6 +465,26 @@ namespace Validator {
Tag = input.ReadString();
break;
}
case 32: {
Year = input.ReadInt32();
break;
}
case 40: {
Month = input.ReadInt32();
break;
}
case 48: {
Day = input.ReadInt32();
break;
}
case 56: {
Hour = input.ReadInt32();
break;
}
case 64: {
Minute = input.ReadInt32();
break;
}
}
}
}
......
......@@ -12,6 +12,11 @@ message Message {
int32 localPriority = 5;
string text = 6;
string tag = 7;
int32 year = 8;
int32 month = 9;
int32 day = 10;
int32 hour = 11;
int32 minute = 12;
}
......
......@@ -24,18 +24,19 @@ namespace GGRPCMessageGenerator {
static SchemaReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIoEBCgdNZXNzYWdl",
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIskBCgdNZXNzYWdl",
"EhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVtc2dJZBgD",
"IAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9yaXR5GAUg",
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJIjcKD0Fja25vd2xlZGdl",
"bWVudBIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkcK",
"BFNlbmQSPwoLU2VuZE1lc3NhZ2USEy5UcmFubWl0dGVyLk1lc3NhZ2UaGy5U",
"cmFubWl0dGVyLkFja25vd2xlZGdlbWVudEIYqgIVR0dSUENNZXNzYWdlR2Vu",
"ZXJhdG9yYgZwcm90bzM="));
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJEgwKBHllYXIYCCABKAUS",
"DQoFbW9udGgYCSABKAUSCwoDZGF5GAogASgFEgwKBGhvdXIYCyABKAUSDgoG",
"bWludXRlGAwgASgFIjcKD0Fja25vd2xlZGdlbWVudBIRCglyZXBseUNvZGUY",
"ASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkcKBFNlbmQSPwoLU2VuZE1lc3Nh",
"Z2USEy5UcmFubWl0dGVyLk1lc3NhZ2UaGy5UcmFubWl0dGVyLkFja25vd2xl",
"ZGdlbWVudEIYqgIVR0dSUENNZXNzYWdlR2VuZXJhdG9yYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::GGRPCMessageGenerator.Message), global::GGRPCMessageGenerator.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::GGRPCMessageGenerator.Message), global::GGRPCMessageGenerator.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag", "Year", "Month", "Day", "Hour", "Minute" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::GGRPCMessageGenerator.Acknowledgement), global::GGRPCMessageGenerator.Acknowledgement.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
}));
}
......@@ -85,6 +86,11 @@ namespace GGRPCMessageGenerator {
localPriority_ = other.localPriority_;
text_ = other.text_;
tag_ = other.tag_;
year_ = other.year_;
month_ = other.month_;
day_ = other.day_;
hour_ = other.hour_;
minute_ = other.minute_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
......@@ -178,6 +184,66 @@ namespace GGRPCMessageGenerator {
}
}
/// <summary>Field number for the "year" field.</summary>
public const int YearFieldNumber = 8;
private int year_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Year {
get { return year_; }
set {
year_ = value;
}
}
/// <summary>Field number for the "month" field.</summary>
public const int MonthFieldNumber = 9;
private int month_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Month {
get { return month_; }
set {
month_ = value;
}
}
/// <summary>Field number for the "day" field.</summary>
public const int DayFieldNumber = 10;
private int day_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Day {
get { return day_; }
set {
day_ = value;
}
}
/// <summary>Field number for the "hour" field.</summary>
public const int HourFieldNumber = 11;
private int hour_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Hour {
get { return hour_; }
set {
hour_ = value;
}
}
/// <summary>Field number for the "minute" field.</summary>
public const int MinuteFieldNumber = 12;
private int minute_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Minute {
get { return minute_; }
set {
minute_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
......@@ -200,6 +266,11 @@ namespace GGRPCMessageGenerator {
if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
if (Year != other.Year) return false;
if (Month != other.Month) return false;
if (Day != other.Day) return false;
if (Hour != other.Hour) return false;
if (Minute != other.Minute) return false;
return Equals(_unknownFields, other._unknownFields);
}
......@@ -214,6 +285,11 @@ namespace GGRPCMessageGenerator {
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (Year != 0) hash ^= Year.GetHashCode();
if (Month != 0) hash ^= Month.GetHashCode();
if (Day != 0) hash ^= Day.GetHashCode();
if (Hour != 0) hash ^= Hour.GetHashCode();
if (Minute != 0) hash ^= Minute.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
......@@ -260,6 +336,26 @@ namespace GGRPCMessageGenerator {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
......@@ -298,6 +394,26 @@ namespace GGRPCMessageGenerator {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
......@@ -329,6 +445,21 @@ namespace GGRPCMessageGenerator {
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (Year != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Year);
}
if (Month != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Month);
}
if (Day != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Day);
}
if (Hour != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Hour);
}
if (Minute != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Minute);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
......@@ -362,6 +493,21 @@ namespace GGRPCMessageGenerator {
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
if (other.Year != 0) {
Year = other.Year;
}
if (other.Month != 0) {
Month = other.Month;
}
if (other.Day != 0) {
Day = other.Day;
}
if (other.Hour != 0) {
Hour = other.Hour;
}
if (other.Minute != 0) {
Minute = other.Minute;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
......@@ -405,6 +551,26 @@ namespace GGRPCMessageGenerator {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
#endif
......@@ -448,6 +614,26 @@ namespace GGRPCMessageGenerator {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
}
......
......@@ -15,5 +15,10 @@ namespace MessagesConsumer
public int localPriority { get; set; }
public string? text { get; set; }
public string? tag { get; set; }
public int year { get; set; }
public int month { get; set; }
public int day { get; set; }
public int hour { get; set; }
public int minute { get; set; }
}
}
......@@ -6,7 +6,7 @@ using MessagesConsumer.StreamsHandler;
var tokenSource = new CancellationTokenSource();
var token = tokenSource.Token;
string redis_read = "localhost:6379";
string redis_read = "localhost:6400";
try
{
......
......@@ -15,5 +15,10 @@ namespace PriorityStream
public int localPriority { get; set; }
public string? text { get; set; }
public string? tag { get; set; }
public int year { get; set; }
public int month { get; set; }
public int day { get; set; }
public int hour { get; set; }
public int minute { get; set; }
}
}
......@@ -8,7 +8,7 @@ var tokenSource = new CancellationTokenSource();
var token = tokenSource.Token;
string redis_read = "localhost:6379";
string redis_wite = "localhost:6379";
string redis_wite = "localhost:6400";
try
{
......
using MongoDB.Bson;
using MongoDB.Driver;
using SchedulerNode;
using SchedulerNode.RedisQueuer;
using SchedulerNode.Services;
namespace Scheduler.MongoMessages
{
public class MongoMessagesShceduler
{
private static string MONGODB = "mongodb://127.0.0.1:27017";
private static string DataBaseName = "scheduled-messages";
private static string myCollection = "messages";
public static string ConnectionError = "Error Connecting to MongoDB on : " + MONGODB;
private static IMongoCollection<BsonDocument> collection;
private static string NotTaken = "Not-Taken";
public static string init(string MyId)
{
try
{
var client = new MongoClient(MONGODB);
var database = client.GetDatabase(DataBaseName);
collection = database.GetCollection<BsonDocument>(myCollection);
return "ok";
}
catch (Exception ex)
{
return ex.Message;
}
}
public static string insertMessage(ref Message message)
{
try
{
DateTime date = new DateTime(message.Year, message.Month, message.Day, message.Hour, message.Minute, 2);
var document = new BsonDocument
{
{ "sender", message.ClientID},
{ "timestamp", date },
{ "content", message.Text},
{ "tag" , message.Tag },
{ "priority" , message.LocalPriority},
{ "msg-id" , message.MsgId},
{ "phone-number" , message.PhoneNumber },
{ "api-key" , message.ApiKey },
{ "status" , NotTaken }
};
collection.InsertOne(document);
return "OK";
}
catch (Exception ex)
{
return ConnectionError;
}
}
/*
//getBulkOfMessages where their Oks is MyId (not Acked)
//queue them
//then ack them (ok = Acked)
//when finished get Oks = 0 and put their Ok as MyId
public static void getDuedMessagesAndQueue()
{
bool thereArePending = true;
while (true)
{
if (thereArePending)
{
thereArePending = getBulkMessages(Pending);
}
if (! thereArePending)
{
thereArePending = getBulkMessages(NotTaken);
}
Task.Delay(5000);
}
}
private static bool getBulkMessages(string status)
{
var specificTime = DateTime.UtcNow;
var filter = Builders<BsonDocument>.Filter.And(
Builders<BsonDocument>.Filter.Lte("timestamp", specificTime),
Builders<BsonDocument>.Filter.Eq("status", status)
);
var docs = collection.Find(filter).Limit(limit).ToList<BsonDocument>();
if (docs.Count == 0)
{
return false;
}
UpdateDefinition<BsonDocument> updatePending = Builders<BsonDocument>.Update.Set("status", Pending);
UpdateDefinition<BsonDocument> updateAcj = Builders<BsonDocument>.Update.Set("status", Acked);
foreach (var doc in docs)
{
Message message = getMessage(doc);
var _filter = Builders<BsonDocument>.Filter.Eq("_id", doc["_id"]);
collection.UpdateOne(_filter, updatePending);
}
return true;
}
private static Message getMessage(BsonDocument doc)
{
Message message = new Message();
message.ClientID = (string)doc["sender"];
message.Text = (string)doc["content"];
message.Tag = (string)doc["tag"];
message.LocalPriority = (int)doc["priority"];
message.PhoneNumber = (string)doc["phone-number"];
message.MsgId = (string)doc["msg-id"];
message.ApiKey = (string)doc["api-key"];
message.Year = message.Month = message.Day = message.Hour = message.Minute = 0;
return message;
}
*/
}
}
using Scheduler.MongoMessages;
using SchedulerNode.RedisQueuer;
using SchedulerNode.Services;
using Steeltoe.Discovery.Client;
......@@ -10,9 +11,16 @@ var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddGrpc();
builder.Services.AddDiscoveryClient();
MessageQueues.init();
string MyId = "Scheduler-1";
MongoMessagesShceduler.init(MyId);
var app = builder.Build();
// Configure the HTTP request pipeline.
app.MapGrpcService<QueueMessageService>();
app.MapGet("/", () => "Communication with gRPC endpoints must be made through a gRPC client. To learn how to create a client, visit: https://go.microsoft.com/fwlink/?linkid=2086909");
......
......@@ -12,6 +12,11 @@ message Message {
int32 localPriority = 5;
string text = 6;
string tag = 7;
int32 year = 8;
int32 month = 9;
int32 day = 10;
int32 hour = 11;
int32 minute = 12;
}
......
......@@ -51,17 +51,14 @@ namespace SchedulerNode.RedisQueuer
}
}
public static string addMessage(Message message , IDiscoveryClient discoveryClient)
public static string addMessage(Message message)
{
string id = "Error";
string temp = string.Empty;
//if (message.Tag.Contains(Syriatel, StringComparison.OrdinalIgnoreCase))
{
// get url using discovery client
var resid = addMessageRedisAsync(message, RedisURL);
temp = resid.Result;
}
var resid = addMessageRedisAsync(message, RedisURL);
temp = resid.Result;
if (temp.Equals(RedisConnectionError))
{
return RedisConnectionError;
......
......@@ -3,6 +3,7 @@ using Grpc.Core;
using Steeltoe.Common.Discovery;
using Steeltoe.Discovery;
using SchedulerNode.RedisQueuer;
using Scheduler.MongoMessages;
namespace SchedulerNode.Services
{
......@@ -10,42 +11,77 @@ namespace SchedulerNode.Services
{
private readonly ILogger<QueueMessageService> _logger;
private readonly IDiscoveryClient _client;
private readonly static string ErrorQueuing = "Error";
public readonly static string ErrorConnection = "Error Connecting to Redis";
public readonly static string MyId = "Scheduler-1";
public QueueMessageService(ILogger<QueueMessageService> logger , IDiscoveryClient client)
{
_logger = logger;
_client = client;
//MessageQueues.init();
}
public override Task<Acknowledgement> QueueMessage(Message message, ServerCallContext context)
{
//Console.WriteLine("Message Receieved to Queuer !!");
if (message.Year == 0)
{
return Task.FromResult(SendAsap(ref message));
}
else
{
return Task.FromResult(Schedule(ref message));
}
string reqId = MessageQueues.addMessage(message, _client);
}
public Acknowledgement SendAsap(ref Message message)
{
string reqId = MessageQueues.addMessage(message);
Console.WriteLine("req id grcp que = " + reqId);
if (reqId.Equals(MessageQueues.RedisConnectionError))
{
return Task.FromResult(new Acknowledgement
return (new Acknowledgement
{
ReplyCode = ErrorQueuing,
RequestID = reqId,
});
}
return Task.FromResult(new Acknowledgement
return (new Acknowledgement
{
ReplyCode = "OK on Send : id = " + message.MsgId + " ==> Message Reached Queue"
+ " with priority : " + message.LocalPriority ,
+ " with priority : " + message.LocalPriority,
RequestID = reqId
});
}
private Acknowledgement Schedule(ref Message message)
{
string res = MongoMessagesShceduler.insertMessage(ref message);
if (res.Equals (MongoMessagesShceduler.ConnectionError))
{
return new Acknowledgement
{
ReplyCode = ErrorQueuing,
RequestID = res
};
}
else
{
return new Acknowledgement
{
ReplyCode = res,
RequestID = "id = some id"
};
}
}
}
}
......@@ -24,18 +24,19 @@ namespace SchedulerNode {
static SchemaReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIoEBCgdNZXNzYWdl",
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIskBCgdNZXNzYWdl",
"EhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVtc2dJZBgD",
"IAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9yaXR5GAUg",
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJIjcKD0Fja25vd2xlZGdl",
"bWVudBIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkkK",
"BVF1ZXVlEkAKDFF1ZXVlTWVzc2FnZRITLlRyYW5taXR0ZXIuTWVzc2FnZRob",
"LlRyYW5taXR0ZXIuQWNrbm93bGVkZ2VtZW50QhCqAg1TY2hlZHVsZXJOb2Rl",
"YgZwcm90bzM="));
"ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJEgwKBHllYXIYCCABKAUS",
"DQoFbW9udGgYCSABKAUSCwoDZGF5GAogASgFEgwKBGhvdXIYCyABKAUSDgoG",
"bWludXRlGAwgASgFIjcKD0Fja25vd2xlZGdlbWVudBIRCglyZXBseUNvZGUY",
"ASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkkKBVF1ZXVlEkAKDFF1ZXVlTWVz",
"c2FnZRITLlRyYW5taXR0ZXIuTWVzc2FnZRobLlRyYW5taXR0ZXIuQWNrbm93",
"bGVkZ2VtZW50QhCqAg1TY2hlZHVsZXJOb2RlYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::SchedulerNode.Message), global::SchedulerNode.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::SchedulerNode.Message), global::SchedulerNode.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag", "Year", "Month", "Day", "Hour", "Minute" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::SchedulerNode.Acknowledgement), global::SchedulerNode.Acknowledgement.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
}));
}
......@@ -85,6 +86,11 @@ namespace SchedulerNode {
localPriority_ = other.localPriority_;
text_ = other.text_;
tag_ = other.tag_;
year_ = other.year_;
month_ = other.month_;
day_ = other.day_;
hour_ = other.hour_;
minute_ = other.minute_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
......@@ -178,6 +184,66 @@ namespace SchedulerNode {
}
}
/// <summary>Field number for the "year" field.</summary>
public const int YearFieldNumber = 8;
private int year_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Year {
get { return year_; }
set {
year_ = value;
}
}
/// <summary>Field number for the "month" field.</summary>
public const int MonthFieldNumber = 9;
private int month_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Month {
get { return month_; }
set {
month_ = value;
}
}
/// <summary>Field number for the "day" field.</summary>
public const int DayFieldNumber = 10;
private int day_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Day {
get { return day_; }
set {
day_ = value;
}
}
/// <summary>Field number for the "hour" field.</summary>
public const int HourFieldNumber = 11;
private int hour_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Hour {
get { return hour_; }
set {
hour_ = value;
}
}
/// <summary>Field number for the "minute" field.</summary>
public const int MinuteFieldNumber = 12;
private int minute_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int Minute {
get { return minute_; }
set {
minute_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
......@@ -200,6 +266,11 @@ namespace SchedulerNode {
if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
if (Year != other.Year) return false;
if (Month != other.Month) return false;
if (Day != other.Day) return false;
if (Hour != other.Hour) return false;
if (Minute != other.Minute) return false;
return Equals(_unknownFields, other._unknownFields);
}
......@@ -214,6 +285,11 @@ namespace SchedulerNode {
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (Year != 0) hash ^= Year.GetHashCode();
if (Month != 0) hash ^= Month.GetHashCode();
if (Day != 0) hash ^= Day.GetHashCode();
if (Hour != 0) hash ^= Hour.GetHashCode();
if (Minute != 0) hash ^= Minute.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
......@@ -260,6 +336,26 @@ namespace SchedulerNode {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
......@@ -298,6 +394,26 @@ namespace SchedulerNode {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (Year != 0) {
output.WriteRawTag(64);
output.WriteInt32(Year);
}
if (Month != 0) {
output.WriteRawTag(72);
output.WriteInt32(Month);
}
if (Day != 0) {
output.WriteRawTag(80);
output.WriteInt32(Day);
}
if (Hour != 0) {
output.WriteRawTag(88);
output.WriteInt32(Hour);
}
if (Minute != 0) {
output.WriteRawTag(96);
output.WriteInt32(Minute);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
......@@ -329,6 +445,21 @@ namespace SchedulerNode {
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (Year != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Year);
}
if (Month != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Month);
}
if (Day != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Day);
}
if (Hour != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Hour);
}
if (Minute != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Minute);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
......@@ -362,6 +493,21 @@ namespace SchedulerNode {
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
if (other.Year != 0) {
Year = other.Year;
}
if (other.Month != 0) {
Month = other.Month;
}
if (other.Day != 0) {
Day = other.Day;
}
if (other.Hour != 0) {
Hour = other.Hour;
}
if (other.Minute != 0) {
Minute = other.Minute;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
......@@ -405,6 +551,26 @@ namespace SchedulerNode {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
#endif
......@@ -448,6 +614,26 @@ namespace SchedulerNode {
Tag = input.ReadString();
break;
}
case 64: {
Year = input.ReadInt32();
break;
}
case 72: {
Month = input.ReadInt32();
break;
}
case 80: {
Day = input.ReadInt32();
break;
}
case 88: {
Hour = input.ReadInt32();
break;
}
case 96: {
Minute = input.ReadInt32();
break;
}
}
}
}
......
6f8971af9414862698a411f352acad36316ccd21
1f0e2a1bb6cbe5b4409b9dd8371db07c8488c227
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ScheduledMessagesHandler
{
public class MessageDTO
{
public string? clientID { get; set; }
public string? apiKey { get; set; }
public string? msgId { get; set; }
public string? phoneNumber { get; set; }
public int localPriority { get; set; }
public string? text { get; set; }
public string? tag { get; set; }
public int year { get; set; }
public int month { get; set; }
public int day { get; set; }
public int hour { get; set; }
public int minute { get; set; }
}
}
using MongoDB.Bson;
using MongoDB.Driver;
using ScheduledMessagesHandler.RedisQueuer;
namespace ScheduledMessagesHandler.MongoMessages
{
public class MongoMessagesShceduler
{
private static string MONGODB = "mongodb://127.0.0.1:27017";
private static string DataBaseName = "scheduled-messages";
private static string myCollection = "messages";
public static string ConnectionError = "Error Connecting to MongoDB on : " + MONGODB;
private static IMongoCollection<BsonDocument> collection;
private static string Pending = "Pending";
private static string Acked = "Acked";
//this NotTaken here must be the same of NotTaken in scheduler
private static string NotTaken = "Not-Taken";
private static int limit = 100000;
public static string init()
{
try
{
var client = new MongoClient(MONGODB);
var database = client.GetDatabase(DataBaseName);
collection = database.GetCollection<BsonDocument>(myCollection);
return "ok";
}
catch (Exception ex)
{
return ex.Message;
}
}
public static void getDuedMessagesAndQueue()
{
bool thereArePending = true;
while (true)
{
if (thereArePending)
{
thereArePending = getBulkMessages(Pending);
}
if (! thereArePending)
{
thereArePending = getBulkMessages(NotTaken);
}
//Task.Delay(5000);
}
}
private static bool getBulkMessages(string status)
{
var specificTime = DateTime.UtcNow;
var filter = Builders<BsonDocument>.Filter.And(
Builders<BsonDocument>.Filter.Lte("timestamp", specificTime),
Builders<BsonDocument>.Filter.Eq("status", status)
);
var docs = collection.Find(filter).Limit(limit).ToList<BsonDocument>();
if (docs.Count == 0)
{
return false;
}
UpdateDefinition<BsonDocument> updatePending = Builders<BsonDocument>.Update.Set("status", Pending);
UpdateDefinition<BsonDocument> updateAck = Builders<BsonDocument>.Update.Set("status", Acked);
foreach (var doc in docs)
{
MessageDTO message = getMessage(doc);
var _filter = Builders<BsonDocument>.Filter.Eq("_id", doc["_id"]);
if (!status.Equals(Pending))
{
collection.UpdateOne(_filter, updatePending);
}
string result = MessageQueues.addMessage(message);
if (!result.Equals (MessageQueues.RedisConnectionError))
{
collection.UpdateOne(_filter, updateAck);
//Console.WriteLine(message);
}
}
return true;
}
private static MessageDTO getMessage(BsonDocument doc)
{
MessageDTO message = new MessageDTO();
message.clientID = (string)doc["sender"];
message.text = (string)doc["content"];
message.tag = (string)doc["tag"];
message.localPriority = (int)doc["priority"];
message.phoneNumber = (string)doc["phone-number"];
message.msgId = (string)doc["msg-id"];
message.apiKey = (string)doc["api-key"];
message.year = message.month = message.day = message.hour = message.minute = 0;
return message;
}
}
}
using ScheduledMessagesHandler;
using ScheduledMessagesHandler.MongoMessages;
using ScheduledMessagesHandler.RedisQueuer;
using Steeltoe.Discovery.Client;
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddHostedService<Worker>();
services.AddDiscoveryClient();
})
.Build();
MessageQueues.init();
MongoMessagesShceduler.init();
await host.RunAsync();
{
"profiles": {
"ScheduledMessagesHandler": {
"commandName": "Project",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}
using Newtonsoft.Json;
using ScheduledMessagesHandler;
using StackExchange.Redis;
using Steeltoe.Discovery;
namespace ScheduledMessagesHandler.RedisQueuer
{
public class MessageQueues
{
private static string RedisURL = "localhost:6379";
public static string RedisConnectionError = "Error Writing to Redis";
private static string Syriatel = "SYR";
private static string MTN = "MTN";
private static int LEVELS = 6;
private static IDatabase db = null;
public static void init()
{
var redis = ConnectionMultiplexer.Connect(RedisURL);
db = redis.GetDatabase();
for (int i=1; i < LEVELS; i++)
{
try
{
bool k1 = db.StreamCreateConsumerGroup(Syriatel+"_"+i.ToString(),
"SYS_MSGS",
0,
true);
bool k2 = db.StreamCreateConsumerGroup(MTN+"_"+i.ToString(),
"SYS_MSGS",
0,
true);
if (k1 && k2)
{
Console.WriteLine("OK");
}
}
catch (Exception ex)
{
continue;
}
}
}
public static string addMessage(MessageDTO message)
{
string id = "Error";
string temp = string.Empty;
var resid = addMessageRedisAsync(message, RedisURL);
temp = resid.Result;
if (temp.Equals(RedisConnectionError))
{
return RedisConnectionError;
}
id = message.tag + ":" + message.localPriority + ":" + temp;
return id;
}
private static async Task<string> addMessageRedisAsync(MessageDTO message, string URL)
{
try
{
string tag = getTag(ref message);
string streamName = tag + "_" + message.localPriority.ToString();
//Console.WriteLine("stream name = " + streamName);
var serializedMessage = JsonConvert.SerializeObject(message);
//Console.WriteLine("Sending to stream : " + streamName);
var messageId = await db.StreamAddAsync
(streamName,
new NameValueEntry[]
{
new NameValueEntry("message", serializedMessage)
});
//Console.WriteLine("Done Sending to stream : " + streamName);
//Console.WriteLine("Stream msg id = " + messageId);
//var messageId = "YES";
return messageId.ToString();
}
catch (Exception ex)
{
return await Task.FromResult(RedisConnectionError);
}
}
private static string getTag (ref MessageDTO message)
{
if(message.tag.Contains(Syriatel, StringComparison.OrdinalIgnoreCase))
{
return Syriatel;
}
else
{
return MTN;
}
}
}
}
<Project Sdk="Microsoft.NET.Sdk.Worker">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-ScheduledMessagesHandler-8B5723E2-676C-4BF7-B809-A54587AF3768</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
</ItemGroup>
<PropertyGroup>
<SteeltoeVersion>3.2.6</SteeltoeVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Steeltoe.Connector.ConnectorCore" Version="$(SteeltoeVersion)" />
<PackageReference Include="Steeltoe.Discovery.Eureka" Version="$(SteeltoeVersion)" />
<PackageReference Include="MongoDB.Driver" Version="2.27.0" />
<PackageReference Include="CSRedisCore" Version="3.8.803" />
<PackageReference Include="StackExchange.Redis" Version="2.8.0" />
</ItemGroup>
</Project>
using Steeltoe.Discovery;
using MongoDB.Bson;
using MongoDB.Driver;
using ScheduledMessagesHandler.MongoMessages;
namespace ScheduledMessagesHandler
{
public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;
private readonly IDiscoveryClient client;
//public string ConnectionError = "Error Connecting to MongoDB on : " + MONGODB;
public Worker(ILogger<Worker> logger , IDiscoveryClient discoveryClient)
{
_logger = logger;
client = discoveryClient;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
MongoMessagesShceduler.getDuedMessagesAndQueue();
}
}
}
\ No newline at end of file
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "6.0.0"
}
]
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment