Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Is hosting app responsible for calling Flush() when ends? #127

Closed
jiberan opened this issue Aug 29, 2017 · 3 comments
Closed

Is hosting app responsible for calling Flush() when ends? #127

jiberan opened this issue Aug 29, 2017 · 3 comments

Comments

@jiberan
Copy link

jiberan commented Aug 29, 2017

Hi,
my WCF service is hosted in windows service but I'm not sure if I need to call client.Flush() when windows service stops to ensure that all data will be send.

Should I call it manually?

Thank you.
j.

@jiberan jiberan changed the title Is app responsible for calling Flush() when ends? Is hosting app responsible for calling Flush() when ends? Aug 29, 2017
@tomasr
Copy link
Contributor

tomasr commented Aug 29, 2017

The default telemetry channels do buffer data, so you indeed might want to call Flush() before terminating.

@jiberan
Copy link
Author

jiberan commented Aug 29, 2017

As good place to call Flush() looks OnStop() method in Windows service. But do you know how get instance of TelemetryClient in this place?

@tomasr
Copy link
Contributor

tomasr commented Aug 29, 2017

@jiberan You can just initialize one based on TelemetryConfiguration.Active, which will tie it to the configured telemetry channel, afaik.

@tomasr tomasr closed this as completed Dec 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants