Skip to content

Need help getting a simple example running. #39

@bzuidgeest

Description

@bzuidgeest

I'm trying to use the code in this repo to follow this tutorial:
https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/code_sample_java_create_pushtopic.htm

But I am at a loss on how to exactly use the library.
I have the streamingclient and I do a subscribetopic. But nothing happens. The state on the client seems to be disconnected.
I expected to see some events happening. But I cannot find anything to make it connect. There seems to be a disconnect function but not a connect function.

Any help appreciated.

cobbled together stuff
`
var host = new HostBuilder()
.ConfigureHostConfiguration(configHost =>
{
configHost.SetBasePath(Directory.GetCurrentDirectory());
configHost.AddJsonFile("hostsettings.json", optional: true);
configHost.AddEnvironmentVariables(prefix: "TESTAPP_");
configHost.AddCommandLine(args);
})
.ConfigureAppConfiguration((hostContext, configBuilder) =>
{
configBuilder.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
configBuilder.AddJsonFile(
$"appsettings.{hostContext.HostingEnvironment.EnvironmentName}.json",
optional: true);

                 //configBuilder.AddAzureKeyVault(hostingEnviromentName: hostContext.HostingEnvironment.EnvironmentName);

                 configBuilder.AddEnvironmentVariables(prefix: "TESTAPP_");
                 configBuilder.AddCommandLine(args);

                 if (hostContext.HostingEnvironment.IsDevelopment())
                 {
                     // print out the environment
                     var config = configBuilder.Build();
                     //config.DebugConfigurations();
                 }
             })
             .ConfigureServices((context, services) =>
             {
                 services.AddResilientStreamingClient("Salesforce");

               
                 // Conjure up a RequestServices
                 services.AddTransient<IServiceProviderFactory<IServiceCollection>, DefaultServiceProviderFactory>();
             })
             .ConfigureLogging((hostContext, configLogging) =>
             {
                 configLogging.AddConfiguration(hostContext.Configuration.GetSection("Logging"));
                 configLogging.AddConsole();
                 configLogging.AddDebug();
             })
             .UseConsoleLifetime()
             .Build();

        var sp = host.Services;

        IStreamingClient x = sp.GetRequiredService<IStreamingClient>();
        
        x.SubscribeTopic("/InvoiceStatementUpdates", new MyListener(), -2);
        

        await host.RunAsync();

`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions