diff --git a/.gitignore b/.gitignore index 27ae6f1..cc56ee5 100644 --- a/.gitignore +++ b/.gitignore @@ -373,3 +373,4 @@ FodyWeavers.xsd # Local History for Visual Studio Code .history/ +franz/nugify.sh diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..8990c64 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/franz.tests/bin/Debug/net5.0/franz.tests.dll", + "args": [], + "cwd": "${workspaceFolder}/franz.tests", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..03461aa --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/franz.tests/franz.tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/franz.tests/franz.tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/franz.tests/franz.tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/franz/Telefranz.cs b/franz/Telefranz.cs index b0f5544..5c63f34 100644 --- a/franz/Telefranz.cs +++ b/franz/Telefranz.cs @@ -80,26 +80,25 @@ namespace franz public void addHandler(Action theAction) where T : silver_messages.message { - Console.WriteLine($"typeof(T) reports as {typeof(T)}."); var topic = typeof(T).ToString(); Action> wrapped = (kr) => { - Console.WriteLine($"wrapped receives kafkarecord, is ready to process: {kr.Value}"); var deserialized = JsonConvert.DeserializeObject(kr.Value); if(deserialized != null && deserialized.type == deserialized.GetType().ToString()) { - Console.WriteLine("message deserialized for this handler"); - theAction(deserialized); - Console.WriteLine("action survived"); - } - else - { - Console.WriteLine("message didn't deserialize for this handler"); + try + { + theAction(deserialized); + } + catch(Exception e) + { + consoleLogger.LogError("if I don't catch this error the whole thing dies so..."); + consoleLogger.LogError(JsonConvert.SerializeObject(e)); + } } }; if(!topicConsumers.ContainsKey(typeof(T).ToString())){ - Console.WriteLine($"making consumer for {handling_group}, topic {topic}"); topicConsumers[topic] = new KafkaConsumer(topic, clusterClient); topicConsumers[topic].ConsumeFromLatest(); topicSubscribers.Add(topic, 0); @@ -121,8 +120,8 @@ namespace franz public void ProduceMessage(T message) where T : silver_messages.message { - Console.WriteLine($"producing message {message}"); clusterClient.Produce(typeof(T).ToString(), message.ToString()); } + public void HiImAFunction(){} } } \ No newline at end of file diff --git a/franz/franz.csproj b/franz/franz.csproj index 546eec7..921ee9e 100644 --- a/franz/franz.csproj +++ b/franz/franz.csproj @@ -3,7 +3,7 @@ net5.0 silvermeddlists.franz - 0.0.1 + 0.0.2 adam Silver Meddlists diff --git a/franz/silver_messages/directorial/command_completed.cs b/franz/silver_messages/directorial/command_ended.cs similarity index 59% rename from franz/silver_messages/directorial/command_completed.cs rename to franz/silver_messages/directorial/command_ended.cs index 6870611..a57518e 100644 --- a/franz/silver_messages/directorial/command_completed.cs +++ b/franz/silver_messages/directorial/command_ended.cs @@ -4,15 +4,18 @@ using silver_messages; namespace silver_messages.directorial { - public class command_completed : silver_messages.message + public abstract class command_ended : silver_messages.message { //name of the command that was called public string command { get; set; } - //runtime in ms - public uint runtime { get; set; } public string stdout { get; set; } public string stderr { get; set; } - public int exit_code { get; set; } } -} + public class command_completed : command_ended + { + public int exit_code { get; set; } + public long runtimeMilliseconds { get; set; } + } + public class command_expired : command_ended {} +} diff --git a/franz/silver_messages/directorial/command_expired.cs b/franz/silver_messages/directorial/command_expired.cs deleted file mode 100644 index 64f0e63..0000000 --- a/franz/silver_messages/directorial/command_expired.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using silver_messages; -namespace silver_messages.directorial -{ - public class command_expired : silver_messages.message - { - //name of the command that was called - public string command { get; set; } - //runtime in ms - public uint runtime { get; set; } - } -} \ No newline at end of file diff --git a/franz/silver_messages/directorial/execute_command.cs b/franz/silver_messages/directorial/execute_command.cs index 01f365a..732f8ce 100644 --- a/franz/silver_messages/directorial/execute_command.cs +++ b/franz/silver_messages/directorial/execute_command.cs @@ -19,4 +19,3 @@ namespace silver_messages.directorial public int timeout { get; set; } } } -