Beispiel #1
0
    static async Task Main(string[] args)
    {
        Console.Title = "Samples.SessionFilter.Sender";
        var endpointConfiguration = new EndpointConfiguration("Samples.SessionFilter.Sender");

        endpointConfiguration.UsePersistence <LearningPersistence>();
        var transport = endpointConfiguration.UseTransport <LearningTransport>();

        transport.Routing().RouteToEndpoint(
            typeof(SomeMessage),
            "Samples.SessionFilter.Receiver"
            );

        #region add-filter-behavior

        var sessionKeyProvider = new RotatingSessionKeyProvider();

        endpointConfiguration.ApplySessionFilter(sessionKeyProvider);

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        #endregion

        await MainLoop(endpointInstance, sessionKeyProvider)
        .ConfigureAwait(false);

        await endpointInstance.Stop()
        .ConfigureAwait(false);
    }
Beispiel #2
0
    static async Task Main(string[] args)
    {
        Console.Title = "Samples.SessionFilter.Receiver";
        var endpointConfiguration = new EndpointConfiguration("Samples.SessionFilter.Receiver");

        endpointConfiguration.UsePersistence <LearningPersistence>();
        var transport = endpointConfiguration.UseTransport <LearningTransport>();

        var sessionKeyProvider = new RotatingSessionKeyProvider();

        endpointConfiguration.ApplySessionFilter(sessionKeyProvider);

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        MainLoop(sessionKeyProvider);

        await endpointInstance.Stop()
        .ConfigureAwait(false);
    }