This project is read-only.

Configuring the Tcp Transport Service

This page explains how you can configure the Tcp Transport Service, either by config string or by fluent interface.

Config String

With the config string the following options can be configured:
  • tcp.port: Configures the tcp port that should be used to handle incoming communication.
  • tcp.name: Configures the name of the transport service. A name should be assigned if the space instance uses multiple transport services.
  • tcp.isdefault: Configures if the transport service is used by default for connecting to other workers (one service should be configured as default, if multiple transport services are used).
  • tcp.lifetime: Configures the connection lifetime (time after which a connection is closed when no messages are sent or received). The default value is 1 minute. For some scenarios it can make sense to leave connections open for a longer time span to reduce the need for sending messages just to keep the connection alive. The value must be in the format "mm:ss".
  • tcp.key: Configures that incoming connections should be authenticated with the given key. When two spaces communicate, both need to have the same key defined. When a key is defined, a simple handshake is done when the tcp connection is created.
Here is an example:
var space = new XcoAppSpace("tcp.port=9000;tcp.name=tcpservice;tcp.isdefault=true;tcp.lifetime=10:00");

Fluent Inferface

The fluent interface provides methods equal to the config string elements:
  • OnPort(int port): Configures the tcp port that should be used to handle incoming communication.
  • WithName(string name): Configures the name of the transport service. A name should be assigned if the space instance uses multiple transport services.
  • AsDefault(): Configures that the transport service is used by default for connecting to other workers (one service should be configured as default, if multiple transport services are used).
  • WithConnectionLifetime(TimeSpan lifetime): Configures the connection lifetime (time after which a connection is closed when no messages are sent or received). The default value is 1 minute. For some scenarios it can make sense to leave connections open for a longer time span to reduce the need for sending messages just to keep the connection alive.
  • WithAuthenticationKey(string key): Configures that incoming connections should be authenticated with the given key. When two spaces communicate, both need to have the same key defined. When a key is defined, a simple handshake is done when the tcp connection is created.
  • WithSerializer(string name): Allows defining which serializer is used for this transport service, if there are multiple named serializers defined for this appspace instance (use the .WithName() fluent config method to define the serializer name). Note: this is only needed if you have multiple transport services, and want to communicate using a different serializer for each of them.
Here is an example:
XcoAppSpace space = XcoAppSpace.Configure.UsingService<XcoTCPTransportService>()
    .OnPort(9000)
    .WithName("tcpservice")
    .WithConnectionLifetime(TimeSpan.FromMinutes(10))
    .AsDefault();

Last edited Dec 27, 2012 at 10:38 AM by thomass, version 6

Comments

No comments yet.