Kafka-Client-Dotnet 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Kafka-Client-Dotnet --version 1.0.0                
NuGet\Install-Package Kafka-Client-Dotnet -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kafka-Client-Dotnet" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kafka-Client-Dotnet --version 1.0.0                
#r "nuget: Kafka-Client-Dotnet, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Kafka-Client-Dotnet as a Cake Addin
#addin nuget:?package=Kafka-Client-Dotnet&version=1.0.0

// Install Kafka-Client-Dotnet as a Cake Tool
#tool nuget:?package=Kafka-Client-Dotnet&version=1.0.0                

Kafka-Client-Dotnet

A kafka library for process documents from queue, note that this project is a not final project, instead is a library that will be used and implemented on final project

Pack it

dotnet pack

Using it

The main scope for this project is keep the kafka connection and process consumed documents. You must implement two interfaces for use it.

Wrapper

the wrapper mut be implement for a custom mappinb gtom kafka document.

The follow is a example of implementation of wrapper, note that you should implement IWrapper interface:

using System;
using System.Collections.Generic;
using PrintQueue.Implementations;

namespace PrintQueue.Wrappers {
	public class DefaultWrapper : IWrapper {

		/**	Port Name	*/
		public String port_name { get; set; }
		/**	Printer Name	*/
		public String printer_name { get; set; }
		
		public String GetPortName() {
			return port_name;
		}
		public String GetPrinterName() {
			return printer_name;
		}
	}
}

When IWrapper is implemented is mandatory implement two methods:

public String GetPortName() {
	return port_name;
}
public String GetPrinterName() {
	return printer_name;
}

Consumer

The consumer or callback is used for implement two actions:

  • GetWrapper: Is called from service and hope a IWrapper implementation to process. If the return is null then the ProcessDocument is not called
  • ProcessDocument: After get the wrapper, the service call this method for process the document. You should implement here your custom action like print a document or anything.

See the example here:

using System;
using System.Collections.Generic;
using PrintQueue.Implementations;
using PrintQueue.Wrappers;
using System.Text.Json;

namespace PrintQueue.Clients {
	public class DefaultConsumer : IConsumer {

		/** Get a object converted from value	*/
		public IWrapper GetWrapper(String key, byte[] value) {
			IWrapper wrapper = null;
			if(key.Equals("document")) {
            	Document printDocument = JsonSerializer.Deserialize<Document>(value);
            	Console.WriteLine("Document: " + printDocument.invoice.document_no);
				wrapper = printDocument;
            } else if(key.Equals("report")) {
            	Report printReport = JsonSerializer.Deserialize<Report>(value);
            	Console.WriteLine("Report: " + printReport.document_type);
				wrapper = printReport;
            } else if(key.Equals("setup")) {
            	Setup printSetup = JsonSerializer.Deserialize<Setup>(value);
            	Console.WriteLine("Setup: " + printSetup.type); 
				wrapper = printSetup;
            } else {
            	Console.WriteLine("Unsupported type: " + key);    
            }
			return wrapper;
		}
		/**	Print Document	*/
		public void ProcessDocument(IWrapper document) {
			Console.WriteLine("Hi: " + document);
		}
	}
}

Final Implementartion

The service can be called from a Main method like is defined the follow:

using System;
using System.Collections.Generic;
using PrintQueue.Implementations;
using PrintQueue.Wrappers;
using System.Text.Json;
using PrintQueue.Kafka;

namespace PrintQueue.Clients {
	public class TestImplementation {

		
        public static void Main(string[] args) {
            if(args == null) {
                throw new Exception("Arguments Not Found");
            }
            //	
            if(args == null || args.Length == 0) {
                throw new Exception("Arguments Must Be: [property file name]");
            }
			DefaultConsumer defaultConsumer = new DefaultConsumer();
            // 
			Service service = new Service(args[0], defaultConsumer);
			service.start();
        }
	}
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Kafka-Client-Dotnet:

Package Downloads
fiscal-printer-dotnet

This package adds support to Fiscal Printer Receiver based on Kafka service

local-printing-all-in-one-dotnet

This package adds support to Fiscal Printer sing The Factory HKA and other providers

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.9 216 6/6/2024
1.2.8 477 10/19/2023
1.2.7 130 10/19/2023
1.2.6 129 10/19/2023
1.2.5 136 10/19/2023
1.2.4 1,377 2/28/2022
1.2.3 444 2/26/2022
1.2.2 453 2/26/2022
1.2.1 462 2/26/2022
1.2.0 464 2/22/2022
1.1.9 876 2/2/2022
1.1.8 466 1/26/2022
1.1.7 776 1/25/2022
1.1.6 926 1/25/2022
1.1.5 1,198 1/22/2022
1.1.4 914 1/18/2022
1.1.3 437 1/18/2022
1.1.2 424 1/18/2022
1.1.1 1,030 1/17/2022
1.1.0 441 1/17/2022
1.0.8 340 12/13/2021
1.0.7 808 12/13/2021
1.0.6 410 12/13/2021
1.0.5 313 12/10/2021
1.0.4 747 12/10/2021
1.0.3 301 12/9/2021
1.0.2 523 12/9/2021
1.0.1 496 12/9/2021
1.0.0 518 12/9/2021