Hazelcast .Net Client
It is implemented using the Hazelcast Open Binary Client Protocol
You can install .net client from NuGet Repo using PackageManager:
PM> Install-Package Hazelcast.Net
Net Core and .Net Framework Support
Hazelcast .Net Client supports .Net Framemork 4.0+ and Net Core 2.0+ .
You can configure the Hazelcast .Net Client via API or XML. To start the client, you can pass a configuration or leave it empty to use default values.
For programatic configuration; please see
Hazelcast.Config packege and related API doc.
For XML configuration; .Net Client uses the same XML schema of Hazelcast Java Client.
Sample client configuration:
var clientConfig = new ClientConfig(); clientConfig.GetNetworkConfig().AddAddress( "10.0.0.1" ); clientConfig.GetNetworkConfig().AddAddress( "10.0.0.2:5702" ); // Portable Serialization setup up clientConfig.GetSerializationConfig() .AddPortableFactory( MyPortableFactory.FactoryId, new MyPortableFactory() );
Starting the Client
After configuration, you can obtain a client using one of the static methods of Hazelcast, as shown below.
//client with default configuration IHazelcastInstance defaultClient = HazelcastClient.NewHazelcastClient(); //client with custom configuration IHazelcastInstance client = HazelcastClient.NewHazelcastClient(clientConfig); //client configured from an xml configuration file IHazelcastInstance xmlConfClient = Hazelcast.NewHazelcastClient(@"..\Hazelcast.Net\Resources\hazelcast-client.xml");
All distributed objects can be obtained from client
IHazelcastInstance. An example for map is shown below:
var map = client.GetMap<string,string>("mapName"); map.Put("key", "value");
Hazelcast.Examples project on this repo for various code samples.
Please refer to Hazelcast Reference Manual.
How to build
You can build the source by calling the batch file
Strong name generation
Hazelcast assemblies are signed using a strong name key. To be able to build the project, you will need to create your own strong name key.
This can be done using the sn.exe tool which ships with .NET framework.
sn -k hazelcast.snk
Furthermore, you will need to update
Hazelcast.Net/Properties/AssemblyInfo.cs with the new public key.
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Hazelcast.Test, PublicKey=00240000049e....b3")]
To get the new public key, use the following commands:
sn -p hazelcast.snk hazelcast.key sn -tp hazelcast.key
How to run tests
All the tests use NUnit, and require a hazelcast.jar and JVM to run the hazelcast instance. The script
build.bat will attempt to download hazelcast.jar for the latest snapshot from Maven Central and will run the tests using the downloaded jar.
Please join the mail group if you are interested in using or developing Hazelcast.
Hazelcast is available under the Apache 2 License. Please see the Licensing appendix for more information.
Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.
Visit www.hazelcast.com for more info.