launchdarkly / hello-apex-server

Hello LaunchDarkly for Salesforce Apex
Other
2 stars 4 forks source link

Does Apex Server works with Managed Package? #6

Closed Rogeriohsjr closed 1 year ago

Rogeriohsjr commented 1 year ago

Hi there,

I don't see any mention in your doc or in Github if that works with managed Package, my guess is that it doesn't since you don't provide de source code so we can't embedded the LaunchDarkly into the managed package, correct?

Regards the current solution you have, don't we need to add a Remote Site Settings in order to the LaunchDarkly to do a callout to LaunchDarkly api? I don't see the instruction for that as well.

Not sure if the solution you are using is a rest callout to Launch Darkly, but if that is the case, if I add Launch Darky after a DML operation, will it work or thrown an error that we can't do a callout After a DML operation?

I tried to look for a documentation about these questions and I didn't see, sorry if this is there somehow. Thank you in advanced!

louis-launchdarkly commented 1 year ago

Hello @Rogeriohsjr, thank you for your question. For the Apex server SDK, the source code is here: https://github.com/launchdarkly/apex-server-sdk

As far as I can tell, LaunchDarkly hasn't built a managed package for the Apex server SDK, and if having a managed package is a prerequisite to including the SDK in other managed packages, then embedding will not work.

There is a separate reason that just including the SDK in a managed package will not work. The Apex Server SDK requires a Go bridge application to push flag data into a Salesforce table, and to retrieve events back to LaunchDarkly. This is why there is no need for a remote site setting as the Apex code is not making REST calls to LaunchDarkly.

Given the SDK is reading a pre-populated table, there shouldn't be an error case failed by a callout.

Hope this answers all your questions.

Rogeriohsjr commented 1 year ago

Hi @louis-launchdarkly , thanks for taking the time to answer.

I didn't mean for you guys to have a managed package, I meant how that works with a managed package, in my case I have an app that is a managed package and we share that in the AppExchange. I was wondering how that would work with LaunchDarkly.

Thanks for the link with the source code, as you said that wouldn't work with a managed package because the Go Bridge. We can't have our customers info like that.

Thanks, it does answer my question, if I understand correctly, in this case, the Go Bridge is responsible to sync/update the Features into the Org, so the Apex code in the end just reads what we have in the object/table, so no callouts from the org side. The org only expose a rest api that the Go Bridge can call to sync/update the Features.

louis-launchdarkly commented 1 year ago

Yes, what you describe is accurate and your last paragraph has the correct understanding. There is no immediate plan to change how LaunchDarkly's Apex SDK work, but if you have a particular Apex request, you can reach out to LaunchDarkly's account executive, or file a support ticket https://support.launchdarkly.com/hc/en-us which our support team can connect you to the product team.