Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help getting a simple example running. #39

Open
bzuidgeest opened this issue May 5, 2022 · 1 comment
Open

Need help getting a simple example running. #39

bzuidgeest opened this issue May 5, 2022 · 1 comment

Comments

@bzuidgeest
Copy link

bzuidgeest commented May 5, 2022

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();

`

@bzuidgeest
Copy link
Author

I got the example from https://ballardsoftware.com/getting-started-with-the-salesforce-streaming-api-in-net-core/ working combined with https://www.forcetalks.com/blog/how-to-integrate-salesforce-streaming-api-with-net-core-application/

Both use the CometD library from kdcllc that is libray (CometD.NetCore.Salesforce) is based on. So I am missing somthing in this library required to make it connect. Where is the "Connect" function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant