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

Validator Service added - no DB for it yet , All clients are sending and receiving correctly

parent 7b9e1709
...@@ -45,7 +45,27 @@ ...@@ -45,7 +45,27 @@
"ProjectGuid": "79a276e9-da51-4434-9241-a0f8e6771232", "ProjectGuid": "79a276e9-da51-4434-9241-a0f8e6771232",
"DisplayName": "HTTPMessageNode", "DisplayName": "HTTPMessageNode",
"ColorIndex": 7 "ColorIndex": 7
},
"79828c38-a68b-4340-9f93-d55c5dcc203a": {
"ProjectGuid": "79828c38-a68b-4340-9f93-d55c5dcc203a",
"DisplayName": "HTTPMessageNode",
"ColorIndex": 8
},
"c008aeeb-fd9f-4d59-b047-a77bd058c12f": {
"ProjectGuid": "c008aeeb-fd9f-4d59-b047-a77bd058c12f",
"DisplayName": "HTTPMessageGenerator",
"ColorIndex": 9
},
"8b5aab7b-c390-40d2-837b-053ede2a4bec": {
"ProjectGuid": "8b5aab7b-c390-40d2-837b-053ede2a4bec",
"DisplayName": "ttt",
"ColorIndex": 10
},
"d2c3addd-ba47-473c-a761-1ce5b1ee6407": {
"ProjectGuid": "d2c3addd-ba47-473c-a761-1ce5b1ee6407",
"DisplayName": "Validator",
"ColorIndex": 11
} }
}, },
"NextColorIndex": 8 "NextColorIndex": 12
} }
\ No newline at end of file
 
using GrpcMessageNode.DataBaseAccess; using Grpc.Net.Client;
namespace GrpcMessageNode.DataBaseAccess namespace GrpcMessageNode.DataBaseAccess
{ {
public static class DBAccess public class DBAccess
{ {
/// <summary> /// <summary>
/// this class encapsulates MessageStorage and ProcessMessage classed and through it /// check message for tag , Authentication , Quota perhaps from service validator with address
/// we access them as a type of layering /// passed as a parameter to the function
/// </summary> /// </summary>
private static string messageStorageURL = "db that stores messagees"; /// <param name="message" > the message we received to check</param>
private static string accountStorageURL = "db that holds information about account + quota"; /// <param name="validatorAddress"> The validator service address which as a mongodb service </param>
/// <returns> validator reply which is ok if we can proceed with account priority</returns>
public static int getPriority(ref Message message , string validatorAddress)
{
//Console.WriteLine("Validating NOW IN GRPC !! ");
ValidatorReply reply = ValidateAsync(message , validatorAddress);
public static int getPriorityAndStoreMessage(Message message) if (reply == null)
{
return -1;
}
if (!reply.ReplyCode.Contains("ok"))
{
return -1;
}
return reply.AccountPriority;
}
private static ValidatorReply ValidateAsync(Message message, string validatorAddress)
{ {
//authenticate and something else with logic and booleans to ensure all operation is done using var channel = GrpcChannel.ForAddress(validatorAddress);
MessageStorage.store(message, messageStorageURL); var client = new Validate.ValidateClient(channel);
int x = ProcessMessage.getPriority(message, accountStorageURL); MessageMetaData messageMeta = extractMetaData(message);
// if something wrong retrn -1 //Console.WriteLine("Calling GRPC for address = " + validatorAddress);
return x; var reply = client.ValidateMessageAsync(messageMeta);
var ans = reply.GetAwaiter().GetResult();
return ans;
} }
private static MessageMetaData extractMetaData(Message message)
{
MessageMetaData metaData = new MessageMetaData();
metaData.Tag = message.Tag;
metaData.ApiKey = message.ApiKey;
metaData.ClientID = message.ClientID;
return metaData;
}
} }
} }
namespace GrpcMessageNode.DataBaseAccess
{
public class MessageStorage
{
//use this class to store messages in database
public static bool store(Message message , string DB)
{
Console.WriteLine(message.MsgId + " - is being stored in data base : " + DB);
return true;
}
}
}
namespace GrpcMessageNode.DataBaseAccess
{
public class ProcessMessage
{
/// use this class to authenticate and process logic on message receipt
/// get the account priority and use it to determine total priority before
/// sending the message to coordinator and queuing
///
public static int getPriority(Message message , string DB)
{
string accId = message.ClientID;
Console.WriteLine("Getting priority of account " + accId + " from DataBase : " + DB);
int x = 1;
return x;
}
}
}
...@@ -6,9 +6,14 @@ ...@@ -6,9 +6,14 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="Protos\validator.proto" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Protobuf Include="Protos\schema.proto" GrpcServices="Server" /> <Protobuf Include="Protos\schema.proto" GrpcServices="Server" />
<Protobuf Include="Protos\schema-queue.proto" GrpcServices="Client" /> <Protobuf Include="Protos\schema-queue.proto" GrpcServices="Client" />
<Protobuf Include="Protos\validator.proto" GrpcServices="Client" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
*/ */
private static int MAX_PRIRITY = 5; private static int MAX_PRIRITY = 5;
private static int MIN_PRIRITY = 1; private static int MIN_PRIRITY = 1;
public static bool setFinalPriority(Message message) public static bool setFinalPriority(ref Message message , string validatorAddress)
{ {
int account_p = DataBaseAccess.DBAccess.getPriorityAndStoreMessage(message); int account_p = DataBaseAccess.DBAccess.getPriority(ref message , validatorAddress);
if (account_p == -1) return false;
int x = account_p + message.LocalPriority; int x = account_p + message.LocalPriority;
if (x > MAX_PRIRITY) x = MAX_PRIRITY; if (x > MAX_PRIRITY) x = MAX_PRIRITY;
if (x < MIN_PRIRITY && x!=-1) x = MIN_PRIRITY; if (x < MIN_PRIRITY && x!=-1) x = MIN_PRIRITY;
message.LocalPriority = x; message.LocalPriority = x;
if (x == -1) return false;
return true; return true;
} }
/// we can complicate the mechanism as much as we want /// we can complicate the mechanism as much as we want
......
...@@ -11,12 +11,14 @@ message Message2 { ...@@ -11,12 +11,14 @@ message Message2 {
string phoneNumber = 4; string phoneNumber = 4;
int32 localPriority = 5; int32 localPriority = 5;
string text = 6; string text = 6;
string tag = 7;
} }
message Acknowledgement2 message Acknowledgement2
{ {
string replyCode = 1; string replyCode = 1;
string requestID = 2;
} }
service Queue { service Queue {
......
...@@ -11,12 +11,14 @@ message Message { ...@@ -11,12 +11,14 @@ message Message {
string phoneNumber = 4; string phoneNumber = 4;
int32 localPriority = 5; int32 localPriority = 5;
string text = 6; string text = 6;
string tag = 7;
} }
message Acknowledgement message Acknowledgement
{ {
string replyCode = 1; string replyCode = 1;
string requestID = 2;
} }
service Send { service Send {
......
syntax = "proto3";
option csharp_namespace = "GrpcMessageNode";
package Validator;
service Validate {
rpc ValidateMessage (MessageMetaData) returns (ValidatorReply);
}
message MessageMetaData {
string clientID = 1;
string apiKey = 2;
string tag = 3;
}
message ValidatorReply {
string replyCode = 1;
int32 accountPriority = 2;
}
...@@ -18,9 +18,13 @@ namespace GrpcMessageNode.Services ...@@ -18,9 +18,13 @@ namespace GrpcMessageNode.Services
public override Task<Acknowledgement> SendMessage(Message message, ServerCallContext context) public override Task<Acknowledgement> SendMessage(Message message, ServerCallContext context)
{ {
string validator = getValidatorAddress();
//Console.WriteLine("Pr = " + message.LocalPriority);
bool res = PriorityHandling.SetPriority.setFinalPriority(message); bool res = true;
res = PriorityHandling.SetPriority.setFinalPriority(ref message , validator);
if (res == false) // something went wrong if (res == false) // something went wrong
{ {
return Task.FromResult(new Acknowledgement return Task.FromResult(new Acknowledgement
...@@ -29,6 +33,9 @@ namespace GrpcMessageNode.Services ...@@ -29,6 +33,9 @@ namespace GrpcMessageNode.Services
}); });
} }
//Console.WriteLine("new Pr = " + message.LocalPriority);
//Console.WriteLine("Account Checker Passed "); //Console.WriteLine("Account Checker Passed ");
string reply = sendToCoordinator(message); string reply = sendToCoordinator(message);
...@@ -73,6 +80,7 @@ namespace GrpcMessageNode.Services ...@@ -73,6 +80,7 @@ namespace GrpcMessageNode.Services
message2.ClientID = message.ClientID; message2.ClientID = message.ClientID;
message2.ApiKey = message.ApiKey; message2.ApiKey = message.ApiKey;
message2.PhoneNumber = message.PhoneNumber; message2.PhoneNumber = message.PhoneNumber;
message2.Tag = message.Tag;
return message2; return message2;
} }
...@@ -86,5 +94,16 @@ namespace GrpcMessageNode.Services ...@@ -86,5 +94,16 @@ namespace GrpcMessageNode.Services
return address; return address;
} }
private string getValidatorAddress()
{
string address = "";
var y = discoveryClient.GetInstances("Validator"); /// write names to config file
address = y[0].Uri.ToString();
return address;
}
} }
} }
obj\Debug\net6.0\Protos/Validator.cs \
obj\Debug\net6.0\Protos/ValidatorGrpc.cs: Protos/validator.proto
\ No newline at end of file
286ecfa468b3d36df6d23da6551204042dd6dca9 de78e082071d7059e64956cfe7d5a48d015e9853
...@@ -24,18 +24,19 @@ namespace GrpcMessageNode { ...@@ -24,18 +24,19 @@ namespace GrpcMessageNode {
static SchemaReflection() { static SchemaReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyInQKB01lc3NhZ2US", "ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIoEBCgdNZXNzYWdl",
"EAoIY2xpZW50SUQYASABKAkSDgoGYXBpS2V5GAIgASgJEg0KBW1zZ0lkGAMg", "EhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVtc2dJZBgD",
"ASgJEhMKC3Bob25lTnVtYmVyGAQgASgJEhUKDWxvY2FsUHJpb3JpdHkYBSAB", "IAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9yaXR5GAUg",
"KAUSDAoEdGV4dBgGIAEoCSIkCg9BY2tub3dsZWRnZW1lbnQSEQoJcmVwbHlD", "ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJIjcKD0Fja25vd2xlZGdl",
"b2RlGAEgASgJMkcKBFNlbmQSPwoLU2VuZE1lc3NhZ2USEy5UcmFubWl0dGVy", "bWVudBIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkcK",
"Lk1lc3NhZ2UaGy5UcmFubWl0dGVyLkFja25vd2xlZGdlbWVudEISqgIPR3Jw", "BFNlbmQSPwoLU2VuZE1lc3NhZ2USEy5UcmFubWl0dGVyLk1lc3NhZ2UaGy5U",
"Y01lc3NhZ2VOb2RlYgZwcm90bzM=")); "cmFubWl0dGVyLkFja25vd2xlZGdlbWVudEISqgIPR3JwY01lc3NhZ2VOb2Rl",
"YgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { 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" }, null, null, null, null), 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.Acknowledgement), global::GrpcMessageNode.Acknowledgement.Parser, new[]{ "ReplyCode" }, null, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.Acknowledgement), global::GrpcMessageNode.Acknowledgement.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
})); }));
} }
#endregion #endregion
...@@ -83,6 +84,7 @@ namespace GrpcMessageNode { ...@@ -83,6 +84,7 @@ namespace GrpcMessageNode {
phoneNumber_ = other.phoneNumber_; phoneNumber_ = other.phoneNumber_;
localPriority_ = other.localPriority_; localPriority_ = other.localPriority_;
text_ = other.text_; text_ = other.text_;
tag_ = other.tag_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -164,6 +166,18 @@ namespace GrpcMessageNode { ...@@ -164,6 +166,18 @@ namespace GrpcMessageNode {
} }
} }
/// <summary>Field number for the "tag" field.</summary>
public const int TagFieldNumber = 7;
private string tag_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Tag {
get { return tag_; }
set {
tag_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -185,6 +199,7 @@ namespace GrpcMessageNode { ...@@ -185,6 +199,7 @@ namespace GrpcMessageNode {
if (PhoneNumber != other.PhoneNumber) return false; if (PhoneNumber != other.PhoneNumber) return false;
if (LocalPriority != other.LocalPriority) return false; if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false; if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -198,6 +213,7 @@ namespace GrpcMessageNode { ...@@ -198,6 +213,7 @@ namespace GrpcMessageNode {
if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode(); if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode();
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode(); if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode(); if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -240,6 +256,10 @@ namespace GrpcMessageNode { ...@@ -240,6 +256,10 @@ namespace GrpcMessageNode {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -274,6 +294,10 @@ namespace GrpcMessageNode { ...@@ -274,6 +294,10 @@ namespace GrpcMessageNode {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -302,6 +326,9 @@ namespace GrpcMessageNode { ...@@ -302,6 +326,9 @@ namespace GrpcMessageNode {
if (Text.Length != 0) { if (Text.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); size += 1 + pb::CodedOutputStream.ComputeStringSize(Text);
} }
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -332,6 +359,9 @@ namespace GrpcMessageNode { ...@@ -332,6 +359,9 @@ namespace GrpcMessageNode {
if (other.Text.Length != 0) { if (other.Text.Length != 0) {
Text = other.Text; Text = other.Text;
} }
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -371,6 +401,10 @@ namespace GrpcMessageNode { ...@@ -371,6 +401,10 @@ namespace GrpcMessageNode {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -410,6 +444,10 @@ namespace GrpcMessageNode { ...@@ -410,6 +444,10 @@ namespace GrpcMessageNode {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
} }
...@@ -453,6 +491,7 @@ namespace GrpcMessageNode { ...@@ -453,6 +491,7 @@ namespace GrpcMessageNode {
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Acknowledgement(Acknowledgement other) : this() { public Acknowledgement(Acknowledgement other) : this() {
replyCode_ = other.replyCode_; replyCode_ = other.replyCode_;
requestID_ = other.requestID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -474,6 +513,18 @@ namespace GrpcMessageNode { ...@@ -474,6 +513,18 @@ namespace GrpcMessageNode {
} }
} }
/// <summary>Field number for the "requestID" field.</summary>
public const int RequestIDFieldNumber = 2;
private string requestID_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string RequestID {
get { return requestID_; }
set {
requestID_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -490,6 +541,7 @@ namespace GrpcMessageNode { ...@@ -490,6 +541,7 @@ namespace GrpcMessageNode {
return true; return true;
} }
if (ReplyCode != other.ReplyCode) return false; if (ReplyCode != other.ReplyCode) return false;
if (RequestID != other.RequestID) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -498,6 +550,7 @@ namespace GrpcMessageNode { ...@@ -498,6 +550,7 @@ namespace GrpcMessageNode {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode(); if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode();
if (RequestID.Length != 0) hash ^= RequestID.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -520,6 +573,10 @@ namespace GrpcMessageNode { ...@@ -520,6 +573,10 @@ namespace GrpcMessageNode {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -534,6 +591,10 @@ namespace GrpcMessageNode { ...@@ -534,6 +591,10 @@ namespace GrpcMessageNode {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -547,6 +608,9 @@ namespace GrpcMessageNode { ...@@ -547,6 +608,9 @@ namespace GrpcMessageNode {
if (ReplyCode.Length != 0) { if (ReplyCode.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode); size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode);
} }
if (RequestID.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -562,6 +626,9 @@ namespace GrpcMessageNode { ...@@ -562,6 +626,9 @@ namespace GrpcMessageNode {
if (other.ReplyCode.Length != 0) { if (other.ReplyCode.Length != 0) {
ReplyCode = other.ReplyCode; ReplyCode = other.ReplyCode;
} }
if (other.RequestID.Length != 0) {
RequestID = other.RequestID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -581,6 +648,10 @@ namespace GrpcMessageNode { ...@@ -581,6 +648,10 @@ namespace GrpcMessageNode {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -600,6 +671,10 @@ namespace GrpcMessageNode { ...@@ -600,6 +671,10 @@ namespace GrpcMessageNode {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
} }
......
...@@ -24,18 +24,19 @@ namespace GrpcMessageNode { ...@@ -24,18 +24,19 @@ namespace GrpcMessageNode {
static SchemaQueueReflection() { static SchemaQueueReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChlQcm90b3Mvc2NoZW1hLXF1ZXVlLnByb3RvEgpUcmFubWl0dGVyInUKCE1l", "ChlQcm90b3Mvc2NoZW1hLXF1ZXVlLnByb3RvEgpUcmFubWl0dGVyIoIBCghN",
"c3NhZ2UyEhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVt", "ZXNzYWdlMhIQCghjbGllbnRJRBgBIAEoCRIOCgZhcGlLZXkYAiABKAkSDQoF",
"c2dJZBgDIAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9y", "bXNnSWQYAyABKAkSEwoLcGhvbmVOdW1iZXIYBCABKAkSFQoNbG9jYWxQcmlv",
"aXR5GAUgASgFEgwKBHRleHQYBiABKAkiJQoQQWNrbm93bGVkZ2VtZW50MhIR", "cml0eRgFIAEoBRIMCgR0ZXh0GAYgASgJEgsKA3RhZxgHIAEoCSI4ChBBY2tu",
"CglyZXBseUNvZGUYASABKAkySwoFUXVldWUSQgoMUXVldWVNZXNzYWdlEhQu", "b3dsZWRnZW1lbnQyEhEKCXJlcGx5Q29kZRgBIAEoCRIRCglyZXF1ZXN0SUQY",
"VHJhbm1pdHRlci5NZXNzYWdlMhocLlRyYW5taXR0ZXIuQWNrbm93bGVkZ2Vt", "AiABKAkySwoFUXVldWUSQgoMUXVldWVNZXNzYWdlEhQuVHJhbm1pdHRlci5N",
"ZW50MkISqgIPR3JwY01lc3NhZ2VOb2RlYgZwcm90bzM=")); "ZXNzYWdlMhocLlRyYW5taXR0ZXIuQWNrbm93bGVkZ2VtZW50MkISqgIPR3Jw",
"Y01lc3NhZ2VOb2RlYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { 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" }, null, null, null, null), 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.Acknowledgement2), global::GrpcMessageNode.Acknowledgement2.Parser, new[]{ "ReplyCode" }, null, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::GrpcMessageNode.Acknowledgement2), global::GrpcMessageNode.Acknowledgement2.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
})); }));
} }
#endregion #endregion
...@@ -83,6 +84,7 @@ namespace GrpcMessageNode { ...@@ -83,6 +84,7 @@ namespace GrpcMessageNode {
phoneNumber_ = other.phoneNumber_; phoneNumber_ = other.phoneNumber_;
localPriority_ = other.localPriority_; localPriority_ = other.localPriority_;
text_ = other.text_; text_ = other.text_;
tag_ = other.tag_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -164,6 +166,18 @@ namespace GrpcMessageNode { ...@@ -164,6 +166,18 @@ namespace GrpcMessageNode {
} }
} }
/// <summary>Field number for the "tag" field.</summary>
public const int TagFieldNumber = 7;
private string tag_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Tag {
get { return tag_; }
set {
tag_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -185,6 +199,7 @@ namespace GrpcMessageNode { ...@@ -185,6 +199,7 @@ namespace GrpcMessageNode {
if (PhoneNumber != other.PhoneNumber) return false; if (PhoneNumber != other.PhoneNumber) return false;
if (LocalPriority != other.LocalPriority) return false; if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false; if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -198,6 +213,7 @@ namespace GrpcMessageNode { ...@@ -198,6 +213,7 @@ namespace GrpcMessageNode {
if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode(); if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode();
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode(); if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode(); if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -240,6 +256,10 @@ namespace GrpcMessageNode { ...@@ -240,6 +256,10 @@ namespace GrpcMessageNode {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -274,6 +294,10 @@ namespace GrpcMessageNode { ...@@ -274,6 +294,10 @@ namespace GrpcMessageNode {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -302,6 +326,9 @@ namespace GrpcMessageNode { ...@@ -302,6 +326,9 @@ namespace GrpcMessageNode {
if (Text.Length != 0) { if (Text.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); size += 1 + pb::CodedOutputStream.ComputeStringSize(Text);
} }
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -332,6 +359,9 @@ namespace GrpcMessageNode { ...@@ -332,6 +359,9 @@ namespace GrpcMessageNode {
if (other.Text.Length != 0) { if (other.Text.Length != 0) {
Text = other.Text; Text = other.Text;
} }
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -371,6 +401,10 @@ namespace GrpcMessageNode { ...@@ -371,6 +401,10 @@ namespace GrpcMessageNode {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -410,6 +444,10 @@ namespace GrpcMessageNode { ...@@ -410,6 +444,10 @@ namespace GrpcMessageNode {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
} }
...@@ -453,6 +491,7 @@ namespace GrpcMessageNode { ...@@ -453,6 +491,7 @@ namespace GrpcMessageNode {
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Acknowledgement2(Acknowledgement2 other) : this() { public Acknowledgement2(Acknowledgement2 other) : this() {
replyCode_ = other.replyCode_; replyCode_ = other.replyCode_;
requestID_ = other.requestID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -474,6 +513,18 @@ namespace GrpcMessageNode { ...@@ -474,6 +513,18 @@ namespace GrpcMessageNode {
} }
} }
/// <summary>Field number for the "requestID" field.</summary>
public const int RequestIDFieldNumber = 2;
private string requestID_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string RequestID {
get { return requestID_; }
set {
requestID_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -490,6 +541,7 @@ namespace GrpcMessageNode { ...@@ -490,6 +541,7 @@ namespace GrpcMessageNode {
return true; return true;
} }
if (ReplyCode != other.ReplyCode) return false; if (ReplyCode != other.ReplyCode) return false;
if (RequestID != other.RequestID) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -498,6 +550,7 @@ namespace GrpcMessageNode { ...@@ -498,6 +550,7 @@ namespace GrpcMessageNode {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode(); if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode();
if (RequestID.Length != 0) hash ^= RequestID.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -520,6 +573,10 @@ namespace GrpcMessageNode { ...@@ -520,6 +573,10 @@ namespace GrpcMessageNode {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -534,6 +591,10 @@ namespace GrpcMessageNode { ...@@ -534,6 +591,10 @@ namespace GrpcMessageNode {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -547,6 +608,9 @@ namespace GrpcMessageNode { ...@@ -547,6 +608,9 @@ namespace GrpcMessageNode {
if (ReplyCode.Length != 0) { if (ReplyCode.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode); size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode);
} }
if (RequestID.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -562,6 +626,9 @@ namespace GrpcMessageNode { ...@@ -562,6 +626,9 @@ namespace GrpcMessageNode {
if (other.ReplyCode.Length != 0) { if (other.ReplyCode.Length != 0) {
ReplyCode = other.ReplyCode; ReplyCode = other.ReplyCode;
} }
if (other.RequestID.Length != 0) {
RequestID = other.RequestID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -581,6 +648,10 @@ namespace GrpcMessageNode { ...@@ -581,6 +648,10 @@ namespace GrpcMessageNode {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -600,6 +671,10 @@ namespace GrpcMessageNode { ...@@ -600,6 +671,10 @@ namespace GrpcMessageNode {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
} }
......
This diff is collapsed.
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Protos/validator.proto
// </auto-generated>
#pragma warning disable 0414, 1591, 8981, 0612
#region Designer generated code
using grpc = global::Grpc.Core;
namespace GrpcMessageNode {
public static partial class Validate
{
static readonly string __ServiceName = "Validator.Validate";
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::GrpcMessageNode.MessageMetaData> __Marshaller_Validator_MessageMetaData = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::GrpcMessageNode.MessageMetaData.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::GrpcMessageNode.ValidatorReply> __Marshaller_Validator_ValidatorReply = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::GrpcMessageNode.ValidatorReply.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::GrpcMessageNode.MessageMetaData, global::GrpcMessageNode.ValidatorReply> __Method_ValidateMessage = new grpc::Method<global::GrpcMessageNode.MessageMetaData, global::GrpcMessageNode.ValidatorReply>(
grpc::MethodType.Unary,
__ServiceName,
"ValidateMessage",
__Marshaller_Validator_MessageMetaData,
__Marshaller_Validator_ValidatorReply);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::GrpcMessageNode.ValidatorReflection.Descriptor.Services[0]; }
}
/// <summary>Client for Validate</summary>
public partial class ValidateClient : grpc::ClientBase<ValidateClient>
{
/// <summary>Creates a new client for Validate</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public ValidateClient(grpc::ChannelBase channel) : base(channel)
{
}
/// <summary>Creates a new client for Validate that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public ValidateClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected ValidateClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected ValidateClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::GrpcMessageNode.ValidatorReply ValidateMessage(global::GrpcMessageNode.MessageMetaData request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ValidateMessage(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::GrpcMessageNode.ValidatorReply ValidateMessage(global::GrpcMessageNode.MessageMetaData request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ValidateMessage, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::GrpcMessageNode.ValidatorReply> ValidateMessageAsync(global::GrpcMessageNode.MessageMetaData request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ValidateMessageAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::GrpcMessageNode.ValidatorReply> ValidateMessageAsync(global::GrpcMessageNode.MessageMetaData request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ValidateMessage, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected override ValidateClient NewInstance(ClientBaseConfiguration configuration)
{
return new ValidateClient(configuration);
}
}
}
}
#endregion
...@@ -37,3 +37,9 @@ ...@@ -37,3 +37,9 @@
2.0 2.0
2.0 2.0
2.0 2.0
2.0
2.0
2.0
2.0
2.0
2.0
...@@ -9,9 +9,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessageGeneratorGRPC", "Mes ...@@ -9,9 +9,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MessageGeneratorGRPC", "Mes
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueuerNode", "QueuerNode\QueuerNode.csproj", "{676D9604-4597-4935-826A-7F054FD5936A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QueuerNode", "QueuerNode\QueuerNode.csproj", "{676D9604-4597-4935-826A-7F054FD5936A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HTTPMessageNode", "HTTPMessageNode\HTTPMessageNode.csproj", "{79828C38-A68B-4340-9F93-D55C5DCC203A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HTTPMessageNode", "HTTPMessageNode\HTTPMessageNode.csproj", "{79828C38-A68B-4340-9F93-D55C5DCC203A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HTTPMessageGenerator", "HTTPMessageGenerator\HTTPMessageGenerator.csproj", "{C008AEEB-FD9F-4D59-B047-A77BD058C12F}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HTTPMessageGenerator", "HTTPMessageGenerator\HTTPMessageGenerator.csproj", "{C008AEEB-FD9F-4D59-B047-A77BD058C12F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validator", "Validator\Validator.csproj", "{D2C3ADDD-BA47-473C-A761-1CE5B1EE6407}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
...@@ -39,6 +41,10 @@ Global ...@@ -39,6 +41,10 @@ Global
{C008AEEB-FD9F-4D59-B047-A77BD058C12F}.Debug|Any CPU.Build.0 = Debug|Any CPU {C008AEEB-FD9F-4D59-B047-A77BD058C12F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C008AEEB-FD9F-4D59-B047-A77BD058C12F}.Release|Any CPU.ActiveCfg = Release|Any CPU {C008AEEB-FD9F-4D59-B047-A77BD058C12F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C008AEEB-FD9F-4D59-B047-A77BD058C12F}.Release|Any CPU.Build.0 = Release|Any CPU {C008AEEB-FD9F-4D59-B047-A77BD058C12F}.Release|Any CPU.Build.0 = Release|Any CPU
{D2C3ADDD-BA47-473C-A761-1CE5B1EE6407}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{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
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -14,5 +14,6 @@ namespace HTTPMessageGenerator ...@@ -14,5 +14,6 @@ namespace HTTPMessageGenerator
public string? phoneNumber { get; set; } public string? phoneNumber { get; set; }
public int localPriority { get; set; } public int localPriority { get; set; }
public string? text { get; set; } public string? text { get; set; }
public string? tag { get; set; }
} }
} }
...@@ -14,18 +14,10 @@ message.clientID = "m-salameh"; ...@@ -14,18 +14,10 @@ message.clientID = "m-salameh";
message.localPriority = 1; message.localPriority = 1;
message.msgId = "msg-id=1"; message.msgId = "msg-id=1";
message.phoneNumber = "043 33 00 83"; message.phoneNumber = "043 33 00 83";
message.tag = "SYYR";
var client = new HttpClient(); var client = new HttpClient();
/*
using StringContent jsonContent = new(
JsonSerializer.Serialize(new
{message
}),
Encoding.UTF8,
"application/json");
*/
StringContent payload = new (JsonSerializer.Serialize(message) , Encoding.UTF8 , "application/json"); StringContent payload = new (JsonSerializer.Serialize(message) , Encoding.UTF8 , "application/json");
......
...@@ -11,12 +11,14 @@ message Message { ...@@ -11,12 +11,14 @@ message Message {
string phoneNumber = 4; string phoneNumber = 4;
int32 localPriority = 5; int32 localPriority = 5;
string text = 6; string text = 6;
string tag = 7;
} }
message Acknowledgement message Acknowledgement
{ {
string replyCode = 1; string replyCode = 1;
string requestID = 2;
} }
service Queue { service Queue {
......
...@@ -24,18 +24,19 @@ namespace HTTPMessageGenerator { ...@@ -24,18 +24,19 @@ namespace HTTPMessageGenerator {
static SchemaReflection() { static SchemaReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyInQKB01lc3NhZ2US", "ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIoEBCgdNZXNzYWdl",
"EAoIY2xpZW50SUQYASABKAkSDgoGYXBpS2V5GAIgASgJEg0KBW1zZ0lkGAMg", "EhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVtc2dJZBgD",
"ASgJEhMKC3Bob25lTnVtYmVyGAQgASgJEhUKDWxvY2FsUHJpb3JpdHkYBSAB", "IAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9yaXR5GAUg",
"KAUSDAoEdGV4dBgGIAEoCSIkCg9BY2tub3dsZWRnZW1lbnQSEQoJcmVwbHlD", "ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJIjcKD0Fja25vd2xlZGdl",
"b2RlGAEgASgJMkkKBVF1ZXVlEkAKDFF1ZXVlTWVzc2FnZRITLlRyYW5taXR0", "bWVudBIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkkK",
"ZXIuTWVzc2FnZRobLlRyYW5taXR0ZXIuQWNrbm93bGVkZ2VtZW50QheqAhRI", "BVF1ZXVlEkAKDFF1ZXVlTWVzc2FnZRITLlRyYW5taXR0ZXIuTWVzc2FnZRob",
"VFRQTWVzc2FnZUdlbmVyYXRvcmIGcHJvdG8z")); "LlRyYW5taXR0ZXIuQWNrbm93bGVkZ2VtZW50QheqAhRIVFRQTWVzc2FnZUdl",
"bmVyYXRvcmIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { 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" }, null, null, null, null), 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.Acknowledgement), global::HTTPMessageGenerator.Acknowledgement.Parser, new[]{ "ReplyCode" }, null, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::HTTPMessageGenerator.Acknowledgement), global::HTTPMessageGenerator.Acknowledgement.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
})); }));
} }
#endregion #endregion
...@@ -83,6 +84,7 @@ namespace HTTPMessageGenerator { ...@@ -83,6 +84,7 @@ namespace HTTPMessageGenerator {
phoneNumber_ = other.phoneNumber_; phoneNumber_ = other.phoneNumber_;
localPriority_ = other.localPriority_; localPriority_ = other.localPriority_;
text_ = other.text_; text_ = other.text_;
tag_ = other.tag_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -164,6 +166,18 @@ namespace HTTPMessageGenerator { ...@@ -164,6 +166,18 @@ namespace HTTPMessageGenerator {
} }
} }
/// <summary>Field number for the "tag" field.</summary>
public const int TagFieldNumber = 7;
private string tag_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Tag {
get { return tag_; }
set {
tag_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -185,6 +199,7 @@ namespace HTTPMessageGenerator { ...@@ -185,6 +199,7 @@ namespace HTTPMessageGenerator {
if (PhoneNumber != other.PhoneNumber) return false; if (PhoneNumber != other.PhoneNumber) return false;
if (LocalPriority != other.LocalPriority) return false; if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false; if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -198,6 +213,7 @@ namespace HTTPMessageGenerator { ...@@ -198,6 +213,7 @@ namespace HTTPMessageGenerator {
if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode(); if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode();
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode(); if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode(); if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -240,6 +256,10 @@ namespace HTTPMessageGenerator { ...@@ -240,6 +256,10 @@ namespace HTTPMessageGenerator {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -274,6 +294,10 @@ namespace HTTPMessageGenerator { ...@@ -274,6 +294,10 @@ namespace HTTPMessageGenerator {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -302,6 +326,9 @@ namespace HTTPMessageGenerator { ...@@ -302,6 +326,9 @@ namespace HTTPMessageGenerator {
if (Text.Length != 0) { if (Text.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); size += 1 + pb::CodedOutputStream.ComputeStringSize(Text);
} }
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -332,6 +359,9 @@ namespace HTTPMessageGenerator { ...@@ -332,6 +359,9 @@ namespace HTTPMessageGenerator {
if (other.Text.Length != 0) { if (other.Text.Length != 0) {
Text = other.Text; Text = other.Text;
} }
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -371,6 +401,10 @@ namespace HTTPMessageGenerator { ...@@ -371,6 +401,10 @@ namespace HTTPMessageGenerator {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -410,6 +444,10 @@ namespace HTTPMessageGenerator { ...@@ -410,6 +444,10 @@ namespace HTTPMessageGenerator {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
} }
...@@ -453,6 +491,7 @@ namespace HTTPMessageGenerator { ...@@ -453,6 +491,7 @@ namespace HTTPMessageGenerator {
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Acknowledgement(Acknowledgement other) : this() { public Acknowledgement(Acknowledgement other) : this() {
replyCode_ = other.replyCode_; replyCode_ = other.replyCode_;
requestID_ = other.requestID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -474,6 +513,18 @@ namespace HTTPMessageGenerator { ...@@ -474,6 +513,18 @@ namespace HTTPMessageGenerator {
} }
} }
/// <summary>Field number for the "requestID" field.</summary>
public const int RequestIDFieldNumber = 2;
private string requestID_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string RequestID {
get { return requestID_; }
set {
requestID_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -490,6 +541,7 @@ namespace HTTPMessageGenerator { ...@@ -490,6 +541,7 @@ namespace HTTPMessageGenerator {
return true; return true;
} }
if (ReplyCode != other.ReplyCode) return false; if (ReplyCode != other.ReplyCode) return false;
if (RequestID != other.RequestID) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -498,6 +550,7 @@ namespace HTTPMessageGenerator { ...@@ -498,6 +550,7 @@ namespace HTTPMessageGenerator {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode(); if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode();
if (RequestID.Length != 0) hash ^= RequestID.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -520,6 +573,10 @@ namespace HTTPMessageGenerator { ...@@ -520,6 +573,10 @@ namespace HTTPMessageGenerator {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -534,6 +591,10 @@ namespace HTTPMessageGenerator { ...@@ -534,6 +591,10 @@ namespace HTTPMessageGenerator {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -547,6 +608,9 @@ namespace HTTPMessageGenerator { ...@@ -547,6 +608,9 @@ namespace HTTPMessageGenerator {
if (ReplyCode.Length != 0) { if (ReplyCode.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode); size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode);
} }
if (RequestID.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -562,6 +626,9 @@ namespace HTTPMessageGenerator { ...@@ -562,6 +626,9 @@ namespace HTTPMessageGenerator {
if (other.ReplyCode.Length != 0) { if (other.ReplyCode.Length != 0) {
ReplyCode = other.ReplyCode; ReplyCode = other.ReplyCode;
} }
if (other.RequestID.Length != 0) {
RequestID = other.RequestID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -581,6 +648,10 @@ namespace HTTPMessageGenerator { ...@@ -581,6 +648,10 @@ namespace HTTPMessageGenerator {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -600,6 +671,10 @@ namespace HTTPMessageGenerator { ...@@ -600,6 +671,10 @@ namespace HTTPMessageGenerator {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
} }
......
...@@ -24,6 +24,18 @@ namespace HTTPMessageNode.Controllers ...@@ -24,6 +24,18 @@ namespace HTTPMessageNode.Controllers
{ {
Console.WriteLine("Msg from : " + messageDTO.clientID); Console.WriteLine("Msg from : " + messageDTO.clientID);
string validator = getValidatorAddress();
Message message = copyMessage(messageDTO);
bool res = PriorityHandling.SetPriority.setFinalPriority(ref message , validator);
if (res == false)
{
return "Error";
}
string address = getAddress(); string address = getAddress();
using var channel = GrpcChannel.ForAddress(address); using var channel = GrpcChannel.ForAddress(address);
var client = new Queue.QueueClient(channel); var client = new Queue.QueueClient(channel);
...@@ -31,20 +43,13 @@ namespace HTTPMessageNode.Controllers ...@@ -31,20 +43,13 @@ namespace HTTPMessageNode.Controllers
Console.WriteLine("Sending to " + address); Console.WriteLine("Sending to " + address);
Message message = copyMessage(messageDTO);
/*Message message = new Message();
message.MsgId = messageDTO.msgId;
message.Text = messageDTO.text;
message.LocalPriority = messageDTO.localPriority;
message.PhoneNumber = messageDTO.phoneNumber;
message.ApiKey = messageDTO.apiKey;
message.ClientID = messageDTO.clientID;*/
var reply = client.QueueMessage(message); var reply = client.QueueMessage(message);
Console.WriteLine(reply.ReplyCode); Console.WriteLine(reply.ReplyCode);
return reply.ReplyCode; return (reply.ReplyCode );
} }
...@@ -58,6 +63,7 @@ namespace HTTPMessageNode.Controllers ...@@ -58,6 +63,7 @@ namespace HTTPMessageNode.Controllers
message.PhoneNumber = messageDTO.phoneNumber; message.PhoneNumber = messageDTO.phoneNumber;
message.ApiKey = messageDTO.apiKey; message.ApiKey = messageDTO.apiKey;
message.ClientID = messageDTO.clientID; message.ClientID = messageDTO.clientID;
message.Tag = messageDTO.tag;
return message; return message;
} }
private string getAddress() private string getAddress()
...@@ -70,5 +76,16 @@ namespace HTTPMessageNode.Controllers ...@@ -70,5 +76,16 @@ namespace HTTPMessageNode.Controllers
return address; return address;
} }
private string getValidatorAddress()
{
string address = "";
var y = discoveryClient.GetInstances("Validator"); /// write names to config file
address = y[0].Uri.ToString();
return address;
}
} }
} }
\ No newline at end of file

using Grpc.Net.Client;
using Validator;
namespace HTTPMessageNode.DataBaseAccess
/// <summary>
/// this class encapsulates MessageStorage and ProcessMessage classed and through it
/// we access them as a type of layering
/// </summary>
{
public class DBAccess
{
/// <summary>
/// check message for tag , Authentication , Quota perhaps from service validator with address
/// passed as a parameter to the function
/// </summary>
/// <param name="message" > the message we received to check</param>
/// <param name="validatorAddress"> The validator service address which as a mongodb service </param>
/// <returns> validator reply which is ok if we can proceed with account priority</returns>
public static int getPriority(ref Message message , string validatorAddress)
{
ValidatorReply reply = ValidateAsync(message , validatorAddress);
if (reply == null)
{
return -1;
}
if (!reply.ReplyCode.Contains("ok"))
{
return -1;
}
Console.WriteLine(reply.ReplyCode);
return reply.AccountPriority;
}
private static ValidatorReply ValidateAsync(Message message, string validatorAddress)
{
using var channel = GrpcChannel.ForAddress(validatorAddress);
var client = new Validate.ValidateClient(channel);
MessageMetaData messageMeta = extractMetaData(message);
var reply = client.ValidateMessageAsync(messageMeta);
var ans = reply.GetAwaiter().GetResult();
return ans;
}
private static MessageMetaData extractMetaData(Message message)
{
MessageMetaData metaData = new MessageMetaData();
metaData.Tag = message.Tag;
metaData.ApiKey = message.ApiKey;
metaData.ClientID = message.ClientID;
return metaData;
}
}
}
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="Protos\validator.proto" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.40.0" /> <PackageReference Include="Grpc.AspNetCore" Version="2.40.0" />
...@@ -34,5 +38,6 @@ ...@@ -34,5 +38,6 @@
<ItemGroup> <ItemGroup>
<Protobuf Include="Protos\schema.proto" GrpcServices="Client" /> <Protobuf Include="Protos\schema.proto" GrpcServices="Client" />
<Protobuf Include="Protos\validator.proto" GrpcServices="Client" />
</ItemGroup> </ItemGroup>
</Project> </Project>
...@@ -14,5 +14,6 @@ namespace HTTPMessageNode ...@@ -14,5 +14,6 @@ namespace HTTPMessageNode
public string? phoneNumber { get; set; } public string? phoneNumber { get; set; }
public int localPriority { get; set; } public int localPriority { get; set; }
public string? text { get; set; } public string? text { get; set; }
public string? tag { get; set; }
} }
} }
namespace HTTPMessageNode.PriorityHandling
{
public class SetPriority
{
/*
* better to make priorities configurable from files !!
*/
private static int MAX_PRIRITY = 5;
private static int MIN_PRIRITY = 1;
public static bool setFinalPriority(ref Message message , string validatorAddress)
{
int account_p = DataBaseAccess.DBAccess.getPriority(ref message , validatorAddress);
if (account_p == -1) return false;
int x = account_p + message.LocalPriority;
if (x > MAX_PRIRITY) x = MAX_PRIRITY;
if (x < MIN_PRIRITY && x!=-1) x = MIN_PRIRITY;
message.LocalPriority = x;
return true;
}
/// we can complicate the mechanism as much as we want
}
}
...@@ -11,12 +11,14 @@ message Message { ...@@ -11,12 +11,14 @@ message Message {
string phoneNumber = 4; string phoneNumber = 4;
int32 localPriority = 5; int32 localPriority = 5;
string text = 6; string text = 6;
string tag = 7;
} }
message Acknowledgement message Acknowledgement
{ {
string replyCode = 1; string replyCode = 1;
string requestID = 2;
} }
service Queue { service Queue {
......
syntax = "proto3";
option csharp_namespace = "Validator";
package Validator;
service Validate {
rpc ValidateMessage (MessageMetaData) returns (ValidatorReply);
}
message MessageMetaData {
string clientID = 1;
string apiKey = 2;
string tag = 3;
}
message ValidatorReply {
string replyCode = 1;
int32 accountPriority = 2;
}
obj\Debug\net6.0\Protos/Validator.cs \
obj\Debug\net6.0\Protos/ValidatorGrpc.cs: Protos/validator.proto
\ No newline at end of file
07356545f4b7d9887cb89969581b06a53fa226d1 4cfc54818bac6f68e42c2cdebb5e9d540dad794f
...@@ -24,18 +24,19 @@ namespace HTTPMessageNode { ...@@ -24,18 +24,19 @@ namespace HTTPMessageNode {
static SchemaReflection() { static SchemaReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyInQKB01lc3NhZ2US", "ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIoEBCgdNZXNzYWdl",
"EAoIY2xpZW50SUQYASABKAkSDgoGYXBpS2V5GAIgASgJEg0KBW1zZ0lkGAMg", "EhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVtc2dJZBgD",
"ASgJEhMKC3Bob25lTnVtYmVyGAQgASgJEhUKDWxvY2FsUHJpb3JpdHkYBSAB", "IAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9yaXR5GAUg",
"KAUSDAoEdGV4dBgGIAEoCSIkCg9BY2tub3dsZWRnZW1lbnQSEQoJcmVwbHlD", "ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJIjcKD0Fja25vd2xlZGdl",
"b2RlGAEgASgJMkkKBVF1ZXVlEkAKDFF1ZXVlTWVzc2FnZRITLlRyYW5taXR0", "bWVudBIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkkK",
"ZXIuTWVzc2FnZRobLlRyYW5taXR0ZXIuQWNrbm93bGVkZ2VtZW50QhKqAg9I", "BVF1ZXVlEkAKDFF1ZXVlTWVzc2FnZRITLlRyYW5taXR0ZXIuTWVzc2FnZRob",
"VFRQTWVzc2FnZU5vZGViBnByb3RvMw==")); "LlRyYW5taXR0ZXIuQWNrbm93bGVkZ2VtZW50QhKqAg9IVFRQTWVzc2FnZU5v",
"ZGViBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { 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" }, null, null, null, null), 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.Acknowledgement), global::HTTPMessageNode.Acknowledgement.Parser, new[]{ "ReplyCode" }, null, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::HTTPMessageNode.Acknowledgement), global::HTTPMessageNode.Acknowledgement.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
})); }));
} }
#endregion #endregion
...@@ -83,6 +84,7 @@ namespace HTTPMessageNode { ...@@ -83,6 +84,7 @@ namespace HTTPMessageNode {
phoneNumber_ = other.phoneNumber_; phoneNumber_ = other.phoneNumber_;
localPriority_ = other.localPriority_; localPriority_ = other.localPriority_;
text_ = other.text_; text_ = other.text_;
tag_ = other.tag_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -164,6 +166,18 @@ namespace HTTPMessageNode { ...@@ -164,6 +166,18 @@ namespace HTTPMessageNode {
} }
} }
/// <summary>Field number for the "tag" field.</summary>
public const int TagFieldNumber = 7;
private string tag_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Tag {
get { return tag_; }
set {
tag_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -185,6 +199,7 @@ namespace HTTPMessageNode { ...@@ -185,6 +199,7 @@ namespace HTTPMessageNode {
if (PhoneNumber != other.PhoneNumber) return false; if (PhoneNumber != other.PhoneNumber) return false;
if (LocalPriority != other.LocalPriority) return false; if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false; if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -198,6 +213,7 @@ namespace HTTPMessageNode { ...@@ -198,6 +213,7 @@ namespace HTTPMessageNode {
if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode(); if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode();
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode(); if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode(); if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -240,6 +256,10 @@ namespace HTTPMessageNode { ...@@ -240,6 +256,10 @@ namespace HTTPMessageNode {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -274,6 +294,10 @@ namespace HTTPMessageNode { ...@@ -274,6 +294,10 @@ namespace HTTPMessageNode {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -302,6 +326,9 @@ namespace HTTPMessageNode { ...@@ -302,6 +326,9 @@ namespace HTTPMessageNode {
if (Text.Length != 0) { if (Text.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); size += 1 + pb::CodedOutputStream.ComputeStringSize(Text);
} }
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -332,6 +359,9 @@ namespace HTTPMessageNode { ...@@ -332,6 +359,9 @@ namespace HTTPMessageNode {
if (other.Text.Length != 0) { if (other.Text.Length != 0) {
Text = other.Text; Text = other.Text;
} }
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -371,6 +401,10 @@ namespace HTTPMessageNode { ...@@ -371,6 +401,10 @@ namespace HTTPMessageNode {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -410,6 +444,10 @@ namespace HTTPMessageNode { ...@@ -410,6 +444,10 @@ namespace HTTPMessageNode {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
} }
...@@ -453,6 +491,7 @@ namespace HTTPMessageNode { ...@@ -453,6 +491,7 @@ namespace HTTPMessageNode {
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Acknowledgement(Acknowledgement other) : this() { public Acknowledgement(Acknowledgement other) : this() {
replyCode_ = other.replyCode_; replyCode_ = other.replyCode_;
requestID_ = other.requestID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -474,6 +513,18 @@ namespace HTTPMessageNode { ...@@ -474,6 +513,18 @@ namespace HTTPMessageNode {
} }
} }
/// <summary>Field number for the "requestID" field.</summary>
public const int RequestIDFieldNumber = 2;
private string requestID_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string RequestID {
get { return requestID_; }
set {
requestID_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -490,6 +541,7 @@ namespace HTTPMessageNode { ...@@ -490,6 +541,7 @@ namespace HTTPMessageNode {
return true; return true;
} }
if (ReplyCode != other.ReplyCode) return false; if (ReplyCode != other.ReplyCode) return false;
if (RequestID != other.RequestID) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -498,6 +550,7 @@ namespace HTTPMessageNode { ...@@ -498,6 +550,7 @@ namespace HTTPMessageNode {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode(); if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode();
if (RequestID.Length != 0) hash ^= RequestID.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -520,6 +573,10 @@ namespace HTTPMessageNode { ...@@ -520,6 +573,10 @@ namespace HTTPMessageNode {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -534,6 +591,10 @@ namespace HTTPMessageNode { ...@@ -534,6 +591,10 @@ namespace HTTPMessageNode {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -547,6 +608,9 @@ namespace HTTPMessageNode { ...@@ -547,6 +608,9 @@ namespace HTTPMessageNode {
if (ReplyCode.Length != 0) { if (ReplyCode.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode); size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode);
} }
if (RequestID.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -562,6 +626,9 @@ namespace HTTPMessageNode { ...@@ -562,6 +626,9 @@ namespace HTTPMessageNode {
if (other.ReplyCode.Length != 0) { if (other.ReplyCode.Length != 0) {
ReplyCode = other.ReplyCode; ReplyCode = other.ReplyCode;
} }
if (other.RequestID.Length != 0) {
RequestID = other.RequestID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -581,6 +648,10 @@ namespace HTTPMessageNode { ...@@ -581,6 +648,10 @@ namespace HTTPMessageNode {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -600,6 +671,10 @@ namespace HTTPMessageNode { ...@@ -600,6 +671,10 @@ namespace HTTPMessageNode {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
} }
......
This diff is collapsed.
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Protos/validator.proto
// </auto-generated>
#pragma warning disable 0414, 1591, 8981, 0612
#region Designer generated code
using grpc = global::Grpc.Core;
namespace Validator {
public static partial class Validate
{
static readonly string __ServiceName = "Validator.Validate";
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static void __Helper_SerializeMessage(global::Google.Protobuf.IMessage message, grpc::SerializationContext context)
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (message is global::Google.Protobuf.IBufferMessage)
{
context.SetPayloadLength(message.CalculateSize());
global::Google.Protobuf.MessageExtensions.WriteTo(message, context.GetBufferWriter());
context.Complete();
return;
}
#endif
context.Complete(global::Google.Protobuf.MessageExtensions.ToByteArray(message));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static class __Helper_MessageCache<T>
{
public static readonly bool IsBufferMessage = global::System.Reflection.IntrospectionExtensions.GetTypeInfo(typeof(global::Google.Protobuf.IBufferMessage)).IsAssignableFrom(typeof(T));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static T __Helper_DeserializeMessage<T>(grpc::DeserializationContext context, global::Google.Protobuf.MessageParser<T> parser) where T : global::Google.Protobuf.IMessage<T>
{
#if !GRPC_DISABLE_PROTOBUF_BUFFER_SERIALIZATION
if (__Helper_MessageCache<T>.IsBufferMessage)
{
return parser.ParseFrom(context.PayloadAsReadOnlySequence());
}
#endif
return parser.ParseFrom(context.PayloadAsNewBuffer());
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Validator.MessageMetaData> __Marshaller_Validator_MessageMetaData = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Validator.MessageMetaData.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Marshaller<global::Validator.ValidatorReply> __Marshaller_Validator_ValidatorReply = grpc::Marshallers.Create(__Helper_SerializeMessage, context => __Helper_DeserializeMessage(context, global::Validator.ValidatorReply.Parser));
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
static readonly grpc::Method<global::Validator.MessageMetaData, global::Validator.ValidatorReply> __Method_ValidateMessage = new grpc::Method<global::Validator.MessageMetaData, global::Validator.ValidatorReply>(
grpc::MethodType.Unary,
__ServiceName,
"ValidateMessage",
__Marshaller_Validator_MessageMetaData,
__Marshaller_Validator_ValidatorReply);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Validator.ValidatorReflection.Descriptor.Services[0]; }
}
/// <summary>Client for Validate</summary>
public partial class ValidateClient : grpc::ClientBase<ValidateClient>
{
/// <summary>Creates a new client for Validate</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public ValidateClient(grpc::ChannelBase channel) : base(channel)
{
}
/// <summary>Creates a new client for Validate that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public ValidateClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected ValidateClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected ValidateClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Validator.ValidatorReply ValidateMessage(global::Validator.MessageMetaData request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ValidateMessage(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual global::Validator.ValidatorReply ValidateMessage(global::Validator.MessageMetaData request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_ValidateMessage, null, options, request);
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Validator.ValidatorReply> ValidateMessageAsync(global::Validator.MessageMetaData request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return ValidateMessageAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
public virtual grpc::AsyncUnaryCall<global::Validator.ValidatorReply> ValidateMessageAsync(global::Validator.MessageMetaData request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_ValidateMessage, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
[global::System.CodeDom.Compiler.GeneratedCode("grpc_csharp_plugin", null)]
protected override ValidateClient NewInstance(ClientBaseConfiguration configuration)
{
return new ValidateClient(configuration);
}
}
}
}
#endregion
...@@ -4,3 +4,7 @@ ...@@ -4,3 +4,7 @@
2.0 2.0
2.0 2.0
2.0 2.0
2.0
2.0
2.0
2.0
...@@ -11,12 +11,14 @@ message Message { ...@@ -11,12 +11,14 @@ message Message {
string phoneNumber = 4; string phoneNumber = 4;
int32 localPriority = 5; int32 localPriority = 5;
string text = 6; string text = 6;
string tag = 7;
} }
message Acknowledgement message Acknowledgement
{ {
string replyCode = 1; string replyCode = 1;
string requestID = 2;
} }
service Send { service Send {
......
...@@ -11,12 +11,14 @@ message Message2 { ...@@ -11,12 +11,14 @@ message Message2 {
string phoneNumber = 4; string phoneNumber = 4;
int32 localPriority = 5; int32 localPriority = 5;
string text = 6; string text = 6;
string tag = 7;
} }
message Acknowledgement2 message Acknowledgement2
{ {
string replyCode = 1; string replyCode = 1;
string requestID = 2;
} }
service Queue { service Queue {
......
...@@ -27,7 +27,7 @@ namespace MessageGeneratorGRPC ...@@ -27,7 +27,7 @@ namespace MessageGeneratorGRPC
message.LocalPriority = 1; message.LocalPriority = 1;
message.MsgId = "msg-id=1"; message.MsgId = "msg-id=1";
message.PhoneNumber = "043 33 00 83"; message.PhoneNumber = "043 33 00 83";
message.Tag = "SYR";
Console.WriteLine("Sending to " + address); Console.WriteLine("Sending to " + address);
......
...@@ -24,18 +24,19 @@ namespace MessageGeneratorGRPC { ...@@ -24,18 +24,19 @@ namespace MessageGeneratorGRPC {
static SchemaReflection() { static SchemaReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyInQKB01lc3NhZ2US", "ChNQcm90b3Mvc2NoZW1hLnByb3RvEgpUcmFubWl0dGVyIoEBCgdNZXNzYWdl",
"EAoIY2xpZW50SUQYASABKAkSDgoGYXBpS2V5GAIgASgJEg0KBW1zZ0lkGAMg", "EhAKCGNsaWVudElEGAEgASgJEg4KBmFwaUtleRgCIAEoCRINCgVtc2dJZBgD",
"ASgJEhMKC3Bob25lTnVtYmVyGAQgASgJEhUKDWxvY2FsUHJpb3JpdHkYBSAB", "IAEoCRITCgtwaG9uZU51bWJlchgEIAEoCRIVCg1sb2NhbFByaW9yaXR5GAUg",
"KAUSDAoEdGV4dBgGIAEoCSIkCg9BY2tub3dsZWRnZW1lbnQSEQoJcmVwbHlD", "ASgFEgwKBHRleHQYBiABKAkSCwoDdGFnGAcgASgJIjcKD0Fja25vd2xlZGdl",
"b2RlGAEgASgJMkcKBFNlbmQSPwoLU2VuZE1lc3NhZ2USEy5UcmFubWl0dGVy", "bWVudBIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJMkcK",
"Lk1lc3NhZ2UaGy5UcmFubWl0dGVyLkFja25vd2xlZGdlbWVudEIXqgIUTWVz", "BFNlbmQSPwoLU2VuZE1lc3NhZ2USEy5UcmFubWl0dGVyLk1lc3NhZ2UaGy5U",
"c2FnZUdlbmVyYXRvckdSUENiBnByb3RvMw==")); "cmFubWl0dGVyLkFja25vd2xlZGdlbWVudEIXqgIUTWVzc2FnZUdlbmVyYXRv",
"ckdSUENiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::MessageGeneratorGRPC.Message), global::MessageGeneratorGRPC.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::MessageGeneratorGRPC.Message), global::MessageGeneratorGRPC.Message.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::MessageGeneratorGRPC.Acknowledgement), global::MessageGeneratorGRPC.Acknowledgement.Parser, new[]{ "ReplyCode" }, null, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::MessageGeneratorGRPC.Acknowledgement), global::MessageGeneratorGRPC.Acknowledgement.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
})); }));
} }
#endregion #endregion
...@@ -83,6 +84,7 @@ namespace MessageGeneratorGRPC { ...@@ -83,6 +84,7 @@ namespace MessageGeneratorGRPC {
phoneNumber_ = other.phoneNumber_; phoneNumber_ = other.phoneNumber_;
localPriority_ = other.localPriority_; localPriority_ = other.localPriority_;
text_ = other.text_; text_ = other.text_;
tag_ = other.tag_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -164,6 +166,18 @@ namespace MessageGeneratorGRPC { ...@@ -164,6 +166,18 @@ namespace MessageGeneratorGRPC {
} }
} }
/// <summary>Field number for the "tag" field.</summary>
public const int TagFieldNumber = 7;
private string tag_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Tag {
get { return tag_; }
set {
tag_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -185,6 +199,7 @@ namespace MessageGeneratorGRPC { ...@@ -185,6 +199,7 @@ namespace MessageGeneratorGRPC {
if (PhoneNumber != other.PhoneNumber) return false; if (PhoneNumber != other.PhoneNumber) return false;
if (LocalPriority != other.LocalPriority) return false; if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false; if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -198,6 +213,7 @@ namespace MessageGeneratorGRPC { ...@@ -198,6 +213,7 @@ namespace MessageGeneratorGRPC {
if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode(); if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode();
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode(); if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode(); if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -240,6 +256,10 @@ namespace MessageGeneratorGRPC { ...@@ -240,6 +256,10 @@ namespace MessageGeneratorGRPC {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -274,6 +294,10 @@ namespace MessageGeneratorGRPC { ...@@ -274,6 +294,10 @@ namespace MessageGeneratorGRPC {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -302,6 +326,9 @@ namespace MessageGeneratorGRPC { ...@@ -302,6 +326,9 @@ namespace MessageGeneratorGRPC {
if (Text.Length != 0) { if (Text.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); size += 1 + pb::CodedOutputStream.ComputeStringSize(Text);
} }
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -332,6 +359,9 @@ namespace MessageGeneratorGRPC { ...@@ -332,6 +359,9 @@ namespace MessageGeneratorGRPC {
if (other.Text.Length != 0) { if (other.Text.Length != 0) {
Text = other.Text; Text = other.Text;
} }
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -371,6 +401,10 @@ namespace MessageGeneratorGRPC { ...@@ -371,6 +401,10 @@ namespace MessageGeneratorGRPC {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -410,6 +444,10 @@ namespace MessageGeneratorGRPC { ...@@ -410,6 +444,10 @@ namespace MessageGeneratorGRPC {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
} }
...@@ -453,6 +491,7 @@ namespace MessageGeneratorGRPC { ...@@ -453,6 +491,7 @@ namespace MessageGeneratorGRPC {
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Acknowledgement(Acknowledgement other) : this() { public Acknowledgement(Acknowledgement other) : this() {
replyCode_ = other.replyCode_; replyCode_ = other.replyCode_;
requestID_ = other.requestID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -474,6 +513,18 @@ namespace MessageGeneratorGRPC { ...@@ -474,6 +513,18 @@ namespace MessageGeneratorGRPC {
} }
} }
/// <summary>Field number for the "requestID" field.</summary>
public const int RequestIDFieldNumber = 2;
private string requestID_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string RequestID {
get { return requestID_; }
set {
requestID_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -490,6 +541,7 @@ namespace MessageGeneratorGRPC { ...@@ -490,6 +541,7 @@ namespace MessageGeneratorGRPC {
return true; return true;
} }
if (ReplyCode != other.ReplyCode) return false; if (ReplyCode != other.ReplyCode) return false;
if (RequestID != other.RequestID) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -498,6 +550,7 @@ namespace MessageGeneratorGRPC { ...@@ -498,6 +550,7 @@ namespace MessageGeneratorGRPC {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode(); if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode();
if (RequestID.Length != 0) hash ^= RequestID.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -520,6 +573,10 @@ namespace MessageGeneratorGRPC { ...@@ -520,6 +573,10 @@ namespace MessageGeneratorGRPC {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -534,6 +591,10 @@ namespace MessageGeneratorGRPC { ...@@ -534,6 +591,10 @@ namespace MessageGeneratorGRPC {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -547,6 +608,9 @@ namespace MessageGeneratorGRPC { ...@@ -547,6 +608,9 @@ namespace MessageGeneratorGRPC {
if (ReplyCode.Length != 0) { if (ReplyCode.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode); size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode);
} }
if (RequestID.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -562,6 +626,9 @@ namespace MessageGeneratorGRPC { ...@@ -562,6 +626,9 @@ namespace MessageGeneratorGRPC {
if (other.ReplyCode.Length != 0) { if (other.ReplyCode.Length != 0) {
ReplyCode = other.ReplyCode; ReplyCode = other.ReplyCode;
} }
if (other.RequestID.Length != 0) {
RequestID = other.RequestID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -581,6 +648,10 @@ namespace MessageGeneratorGRPC { ...@@ -581,6 +648,10 @@ namespace MessageGeneratorGRPC {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -600,6 +671,10 @@ namespace MessageGeneratorGRPC { ...@@ -600,6 +671,10 @@ namespace MessageGeneratorGRPC {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
} }
......
...@@ -24,18 +24,19 @@ namespace MessageGeneratorGRPC { ...@@ -24,18 +24,19 @@ namespace MessageGeneratorGRPC {
static SchemaQReflection() { static SchemaQReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String( byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat( string.Concat(
"ChRQcm90b3Mvc2NoZW1hUS5wcm90bxIKVHJhbm1pdHRlciJ1CghNZXNzYWdl", "ChRQcm90b3Mvc2NoZW1hUS5wcm90bxIKVHJhbm1pdHRlciKCAQoITWVzc2Fn",
"MhIQCghjbGllbnRJRBgBIAEoCRIOCgZhcGlLZXkYAiABKAkSDQoFbXNnSWQY", "ZTISEAoIY2xpZW50SUQYASABKAkSDgoGYXBpS2V5GAIgASgJEg0KBW1zZ0lk",
"AyABKAkSEwoLcGhvbmVOdW1iZXIYBCABKAkSFQoNbG9jYWxQcmlvcml0eRgF", "GAMgASgJEhMKC3Bob25lTnVtYmVyGAQgASgJEhUKDWxvY2FsUHJpb3JpdHkY",
"IAEoBRIMCgR0ZXh0GAYgASgJIiUKEEFja25vd2xlZGdlbWVudDISEQoJcmVw", "BSABKAUSDAoEdGV4dBgGIAEoCRILCgN0YWcYByABKAkiOAoQQWNrbm93bGVk",
"bHlDb2RlGAEgASgJMksKBVF1ZXVlEkIKDFF1ZXVlTWVzc2FnZRIULlRyYW5t", "Z2VtZW50MhIRCglyZXBseUNvZGUYASABKAkSEQoJcmVxdWVzdElEGAIgASgJ",
"aXR0ZXIuTWVzc2FnZTIaHC5UcmFubWl0dGVyLkFja25vd2xlZGdlbWVudDJC", "MksKBVF1ZXVlEkIKDFF1ZXVlTWVzc2FnZRIULlRyYW5taXR0ZXIuTWVzc2Fn",
"F6oCFE1lc3NhZ2VHZW5lcmF0b3JHUlBDYgZwcm90bzM=")); "ZTIaHC5UcmFubWl0dGVyLkFja25vd2xlZGdlbWVudDJCF6oCFE1lc3NhZ2VH",
"ZW5lcmF0b3JHUlBDYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { }, new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::MessageGeneratorGRPC.Message2), global::MessageGeneratorGRPC.Message2.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::MessageGeneratorGRPC.Message2), global::MessageGeneratorGRPC.Message2.Parser, new[]{ "ClientID", "ApiKey", "MsgId", "PhoneNumber", "LocalPriority", "Text", "Tag" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::MessageGeneratorGRPC.Acknowledgement2), global::MessageGeneratorGRPC.Acknowledgement2.Parser, new[]{ "ReplyCode" }, null, null, null, null) new pbr::GeneratedClrTypeInfo(typeof(global::MessageGeneratorGRPC.Acknowledgement2), global::MessageGeneratorGRPC.Acknowledgement2.Parser, new[]{ "ReplyCode", "RequestID" }, null, null, null, null)
})); }));
} }
#endregion #endregion
...@@ -83,6 +84,7 @@ namespace MessageGeneratorGRPC { ...@@ -83,6 +84,7 @@ namespace MessageGeneratorGRPC {
phoneNumber_ = other.phoneNumber_; phoneNumber_ = other.phoneNumber_;
localPriority_ = other.localPriority_; localPriority_ = other.localPriority_;
text_ = other.text_; text_ = other.text_;
tag_ = other.tag_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -164,6 +166,18 @@ namespace MessageGeneratorGRPC { ...@@ -164,6 +166,18 @@ namespace MessageGeneratorGRPC {
} }
} }
/// <summary>Field number for the "tag" field.</summary>
public const int TagFieldNumber = 7;
private string tag_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Tag {
get { return tag_; }
set {
tag_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -185,6 +199,7 @@ namespace MessageGeneratorGRPC { ...@@ -185,6 +199,7 @@ namespace MessageGeneratorGRPC {
if (PhoneNumber != other.PhoneNumber) return false; if (PhoneNumber != other.PhoneNumber) return false;
if (LocalPriority != other.LocalPriority) return false; if (LocalPriority != other.LocalPriority) return false;
if (Text != other.Text) return false; if (Text != other.Text) return false;
if (Tag != other.Tag) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -198,6 +213,7 @@ namespace MessageGeneratorGRPC { ...@@ -198,6 +213,7 @@ namespace MessageGeneratorGRPC {
if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode(); if (PhoneNumber.Length != 0) hash ^= PhoneNumber.GetHashCode();
if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode(); if (LocalPriority != 0) hash ^= LocalPriority.GetHashCode();
if (Text.Length != 0) hash ^= Text.GetHashCode(); if (Text.Length != 0) hash ^= Text.GetHashCode();
if (Tag.Length != 0) hash ^= Tag.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -240,6 +256,10 @@ namespace MessageGeneratorGRPC { ...@@ -240,6 +256,10 @@ namespace MessageGeneratorGRPC {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -274,6 +294,10 @@ namespace MessageGeneratorGRPC { ...@@ -274,6 +294,10 @@ namespace MessageGeneratorGRPC {
output.WriteRawTag(50); output.WriteRawTag(50);
output.WriteString(Text); output.WriteString(Text);
} }
if (Tag.Length != 0) {
output.WriteRawTag(58);
output.WriteString(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -302,6 +326,9 @@ namespace MessageGeneratorGRPC { ...@@ -302,6 +326,9 @@ namespace MessageGeneratorGRPC {
if (Text.Length != 0) { if (Text.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); size += 1 + pb::CodedOutputStream.ComputeStringSize(Text);
} }
if (Tag.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Tag);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -332,6 +359,9 @@ namespace MessageGeneratorGRPC { ...@@ -332,6 +359,9 @@ namespace MessageGeneratorGRPC {
if (other.Text.Length != 0) { if (other.Text.Length != 0) {
Text = other.Text; Text = other.Text;
} }
if (other.Tag.Length != 0) {
Tag = other.Tag;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -371,6 +401,10 @@ namespace MessageGeneratorGRPC { ...@@ -371,6 +401,10 @@ namespace MessageGeneratorGRPC {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -410,6 +444,10 @@ namespace MessageGeneratorGRPC { ...@@ -410,6 +444,10 @@ namespace MessageGeneratorGRPC {
Text = input.ReadString(); Text = input.ReadString();
break; break;
} }
case 58: {
Tag = input.ReadString();
break;
}
} }
} }
} }
...@@ -453,6 +491,7 @@ namespace MessageGeneratorGRPC { ...@@ -453,6 +491,7 @@ namespace MessageGeneratorGRPC {
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public Acknowledgement2(Acknowledgement2 other) : this() { public Acknowledgement2(Acknowledgement2 other) : this() {
replyCode_ = other.replyCode_; replyCode_ = other.replyCode_;
requestID_ = other.requestID_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
} }
...@@ -474,6 +513,18 @@ namespace MessageGeneratorGRPC { ...@@ -474,6 +513,18 @@ namespace MessageGeneratorGRPC {
} }
} }
/// <summary>Field number for the "requestID" field.</summary>
public const int RequestIDFieldNumber = 2;
private string requestID_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string RequestID {
get { return requestID_; }
set {
requestID_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) { public override bool Equals(object other) {
...@@ -490,6 +541,7 @@ namespace MessageGeneratorGRPC { ...@@ -490,6 +541,7 @@ namespace MessageGeneratorGRPC {
return true; return true;
} }
if (ReplyCode != other.ReplyCode) return false; if (ReplyCode != other.ReplyCode) return false;
if (RequestID != other.RequestID) return false;
return Equals(_unknownFields, other._unknownFields); return Equals(_unknownFields, other._unknownFields);
} }
...@@ -498,6 +550,7 @@ namespace MessageGeneratorGRPC { ...@@ -498,6 +550,7 @@ namespace MessageGeneratorGRPC {
public override int GetHashCode() { public override int GetHashCode() {
int hash = 1; int hash = 1;
if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode(); if (ReplyCode.Length != 0) hash ^= ReplyCode.GetHashCode();
if (RequestID.Length != 0) hash ^= RequestID.GetHashCode();
if (_unknownFields != null) { if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode(); hash ^= _unknownFields.GetHashCode();
} }
...@@ -520,6 +573,10 @@ namespace MessageGeneratorGRPC { ...@@ -520,6 +573,10 @@ namespace MessageGeneratorGRPC {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(output); _unknownFields.WriteTo(output);
} }
...@@ -534,6 +591,10 @@ namespace MessageGeneratorGRPC { ...@@ -534,6 +591,10 @@ namespace MessageGeneratorGRPC {
output.WriteRawTag(10); output.WriteRawTag(10);
output.WriteString(ReplyCode); output.WriteString(ReplyCode);
} }
if (RequestID.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
_unknownFields.WriteTo(ref output); _unknownFields.WriteTo(ref output);
} }
...@@ -547,6 +608,9 @@ namespace MessageGeneratorGRPC { ...@@ -547,6 +608,9 @@ namespace MessageGeneratorGRPC {
if (ReplyCode.Length != 0) { if (ReplyCode.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode); size += 1 + pb::CodedOutputStream.ComputeStringSize(ReplyCode);
} }
if (RequestID.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(RequestID);
}
if (_unknownFields != null) { if (_unknownFields != null) {
size += _unknownFields.CalculateSize(); size += _unknownFields.CalculateSize();
} }
...@@ -562,6 +626,9 @@ namespace MessageGeneratorGRPC { ...@@ -562,6 +626,9 @@ namespace MessageGeneratorGRPC {
if (other.ReplyCode.Length != 0) { if (other.ReplyCode.Length != 0) {
ReplyCode = other.ReplyCode; ReplyCode = other.ReplyCode;
} }
if (other.RequestID.Length != 0) {
RequestID = other.RequestID;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
} }
...@@ -581,6 +648,10 @@ namespace MessageGeneratorGRPC { ...@@ -581,6 +648,10 @@ namespace MessageGeneratorGRPC {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
#endif #endif
...@@ -600,6 +671,10 @@ namespace MessageGeneratorGRPC { ...@@ -600,6 +671,10 @@ namespace MessageGeneratorGRPC {
ReplyCode = input.ReadString(); ReplyCode = input.ReadString();
break; break;
} }
case 18: {
RequestID = input.ReadString();
break;
}
} }
} }
} }
......
...@@ -12,9 +12,9 @@ namespace QueuerNode.Helper ...@@ -12,9 +12,9 @@ namespace QueuerNode.Helper
private const int sms_rates = 15; private const int sms_rates = 15;
private Queue<Message>[] messageQueue;// = new Queue<Message>[priority_levels]; private Queue<Message>[] messageQueue;
private object[] locks;// = new object[priority_levels]; private object[] locks;
public MessageQueues() public MessageQueues()
{ {
...@@ -25,8 +25,6 @@ namespace QueuerNode.Helper ...@@ -25,8 +25,6 @@ namespace QueuerNode.Helper
messageQueue[i] = new Queue<Message>(); messageQueue[i] = new Queue<Message>();
locks[i] = new object(); locks[i] = new object();
} }
/*messageQueue = new Queue<Message>[priority_levels];
locks = new object[priority_levels];*/
} }
public void addMessage(Message message) public void addMessage(Message message)
......
...@@ -15,3 +15,4 @@ ...@@ -15,3 +15,4 @@
2.0 2.0
2.0 2.0
2.0 2.0
2.0
using Steeltoe.Discovery.Client;
using Validator.Services;
var builder = WebApplication.CreateBuilder(args);
// Additional configuration is required to successfully run gRPC on macOS.
// For instructions on how to configure Kestrel and gRPC clients on macOS, visit https://go.microsoft.com/fwlink/?linkid=2099682
// Add services to the container.
builder.Services.AddGrpc();
builder.Services.AddDiscoveryClient();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.MapGrpcService<ValidatorService>();
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");
app.Run();
{
"profiles": {
"Validator": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5205;https://localhost:9095",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
syntax = "proto3";
option csharp_namespace = "Validator";
package Validator;
service Validate {
rpc ValidateMessage (MessageMetaData) returns (Reply);
}
message MessageMetaData {
string clientID = 1;
string apiKey = 2;
string tag = 3;
}
message Reply {
string replyCode = 1;
int32 accountPriority = 2;
}
using Grpc.Core;
using Validator;
namespace Validator.Services
{
public class ValidatorService : Validate.ValidateBase
{
private readonly ILogger<ValidatorService> _logger;
public ValidatorService(ILogger<ValidatorService> logger)
{
_logger = logger;
}
public override Task<Reply> ValidateMessage(MessageMetaData messageMetaData , ServerCallContext context)
{
// do some work with /DataBase
return Task.FromResult(new Reply
{
ReplyCode = "OK ok 200 + validated !! ",
AccountPriority = 5
}) ;
}
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Protobuf Include="Protos\validator.proto" GrpcServices="Server" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.40.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.27.1" />
<PackageReference Include="Grpc.Net.Client" Version="2.63.0" />
<PackageReference Include="Grpc.Tools" Version="2.64.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</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)" />
</ItemGroup>
</Project>
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
{
"spring": {
"application": {
"name": "Validator"
}
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"eureka": {
"client": {
"serviceUrl": "http://localhost:8761/eureka/",
"shouldFetchRegistry": "false",
"shouldRegisterWithEureka": true,
"validateCertificates": false
}
},
"AllowedHosts": "*",
"Kestrel": {
"EndpointDefaults": {
"Protocols": "Http2"
}
}
}
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.
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.
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