Skip to content

Allow injecting receiver#307

Merged
ForNeVeR merged 7 commits intoegramtel:masterfrom
bielu:feature/allow-insertion-of-custom-receivers
Apr 1, 2026
Merged

Allow injecting receiver#307
ForNeVeR merged 7 commits intoegramtel:masterfrom
bielu:feature/allow-insertion-of-custom-receivers

Conversation

@bielu
Copy link
Copy Markdown
Contributor

@bielu bielu commented Mar 29, 2026

This is need to allow me to inject custom Receiver with Otel Metrics so i can track how many events we receive from telegram

Closes #169.

@bielu
Copy link
Copy Markdown
Contributor Author

bielu commented Mar 29, 2026

I will need do little more here, as need be able to modify behaviour of ProcessEvents, will think about it and updat epr

@bielu
Copy link
Copy Markdown
Contributor Author

bielu commented Mar 29, 2026

@ForNeVeR i had add interface behind Json client, that allows me fully track now behaviours in Receiver. However maybe you will have better ideas how to track how many events we receive receive from telegram

Copy link
Copy Markdown
Member

@ForNeVeR ForNeVeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also please fix the warnings/compilation issues (I think we have warnings-as-errors here?). Thanks!

}
/// <param name="bindings">Bidings for the client to call functions of TDLib.</param>
/// <param name="receiverTimeOut">Timeout for <c>td_json_client_receive</c>.</param>
public TdClient(IReceiver receiver)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let's construct this in a way that will not produce copy-pasted code.

The standard solution I'd say is to have one "mega"-constructor with all three arguments, and perhaps several overloads as needed; all the overloads would delegate to the "mega"-constructor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will address it tomorrow. Today my mind already gave up

Copy link
Copy Markdown
Contributor Author

@bielu bielu Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I addressed it, however it didnt make sense to have 3 parameters, so final constructor is with IReceiver and all others adding parameters into it. as IReceiver already covers all other version of constructor, as we setup t/o on constructor :)
I see what you meant there, i corrected it now.

@ForNeVeR ForNeVeR assigned ForNeVeR and unassigned bielu Mar 31, 2026
@ForNeVeR ForNeVeR self-requested a review March 31, 2026 11:45
@bielu
Copy link
Copy Markdown
Contributor Author

bielu commented Mar 31, 2026

@ForNeVeR any idea why the test would stuck? I am more than happy to fix issues but locally it all passed lol

@bielu
Copy link
Copy Markdown
Contributor Author

bielu commented Apr 1, 2026

@ForNeVeR i figure out my mistake, it is fixed now

@ForNeVeR ForNeVeR force-pushed the feature/allow-insertion-of-custom-receivers branch 2 times, most recently from 3049c7e to ea59d88 Compare April 1, 2026 22:18
@ForNeVeR ForNeVeR force-pushed the feature/allow-insertion-of-custom-receivers branch from ea59d88 to 9ce4607 Compare April 1, 2026 22:19
Copy link
Copy Markdown
Member

@ForNeVeR ForNeVeR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've adjusted the resulting API for a bit.

@ForNeVeR ForNeVeR merged commit 133d84e into egramtel:master Apr 1, 2026
6 checks passed
@bielu
Copy link
Copy Markdown
Contributor Author

bielu commented Apr 1, 2026

@ForNeVeR is there any chance you can push nuget package with our changes any time soon?

@ForNeVeR
Copy link
Copy Markdown
Member

ForNeVeR commented Apr 1, 2026

Already in progress.

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

Successfully merging this pull request may close these issues.

Expose exceptions happened during TdLib.Bindings.Receiver::ProcessEvents

2 participants