Skip to content

Commit

Permalink
fixing bugs with cluster consistent hash routing (#14)
Browse files Browse the repository at this point in the history
* fixing bugs with cluster consistent hash routing

* fixed issues with K8s and sharding
  • Loading branch information
Aaronontheweb authored May 25, 2019
1 parent 84baabc commit c5bac6a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion k8s/tradeprocessor-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ metadata:
app: trade-processor
spec:
serviceName: trade-processor
replicas: 1
replicas: 3
selector:
matchLabels:
app: trade-processor
Expand Down
1 change: 1 addition & 0 deletions src/Akka.CQRS.Pricing.Service/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ akka {

sharding{
role = "pricing-engine"
state-store-mode = ddata
}

client.receptionist.role = pricing-engine # stops ClusterClient gossip from going to the worker nodes
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.CQRS.TradePlacers.Service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static int Main(string[] args)
Props.Empty.WithRouter(new ClusterRouterGroup(
new ConsistentHashingGroup(new[] {"/user/orderbooks"},
TradeEventConsistentHashMapping.TradeEventMapping),
ClusterRouterGroupSettings.FromConfig(conf))), "tradesRouter");
new ClusterRouterGroupSettings(10000, new []{ "/user/orderbooks" }, true, useRole:"trade-processor"))), "tradesRouter");

Cluster.Cluster.Get(actorSystem).RegisterOnMemberUp(() =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/Akka.CQRS.TradePlacers.Service/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ akka {
provider = cluster

deployment{
/tradeRouter {
/tradesRouter {
router = consistent-hashing-group
routees.paths = ["/user/orderbooks"]
cluster {
Expand Down
1 change: 1 addition & 0 deletions src/Akka.CQRS.TradeProcessor.Service/app.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

sharding{
role = "trade-processor"
state-store-mode = ddata
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Akka.CQRS/Entities/Order.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Akka.CQRS
/// <summary>
/// Represents an unfilled or partially unfilled trade inside the matching engine.
/// </summary>
public struct Order : IWithOrderId, IWithStockId, IEquatable<Order>, IComparable<Order>, IComparable
public sealed class Order : IWithOrderId, IWithStockId, IEquatable<Order>, IComparable<Order>, IComparable
{
/// <summary>
/// Represents an empty or completed trade.
Expand Down

0 comments on commit c5bac6a

Please sign in to comment.