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

CAMEL-9969: Added a component for Telegram #988

Closed
wants to merge 2 commits into from

Conversation

nicolaferraro
Copy link
Member

I created a new component for Telegram.

The component uses the Telegram Bot REST API (https://core.telegram.org/bots/api).
There are multiple Java wrappers for the REST API available as open source projects, but
many of them are not "mature" to be included in the camel component.
An alternative option could have been https://github.com/rubenlagus/TelegramBots, but it is
released under GPLv3 license.
Since the Bot API are simple and well documented, I decided to include a Java REST interface directly inside the component.

The Java API that wraps the REST services contains many features (Text messages, audio, video and photo), but it is not 100% complete.
I don't know if it's worth completing it, or maybe leave some issues on Jira to complete it later.
The API is self-consistent at this time, even if it is not complete.

The Telegram services do not allow two bots to exchange messages, so integration tests would be impossible without a human intervention.
So I divided the tests in two stages:

  • Internal tests: by mocking the Telegram Service, I verify that the service is called passing the correct parameters
  • Integration tests: I call directly the Telegram Service and verify the interaction using my smartphone

Integration tests are disabled in surefire CI (unless you provide some environment variables).

I added a .adoc file for documenting the endpoint (consumer and producer).
I haven't put the documentation on the Wiki pages because...

I think I had better wait for a review :)

@oscerd
Copy link
Contributor

oscerd commented May 20, 2016

LGTM :-)

@davsclaus waiting for your feedback too :-)

* The Camel endpoint for a telegram bot.
*/
@UriEndpoint(scheme = "telegram", title = "Telegram", syntax = "telegram:type/authorizationToken", consumerClass = TelegramConsumer.class, label = "chat")
public class TelegramEndpoint extends DefaultEndpoint {
Copy link
Contributor

Choose a reason for hiding this comment

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

The consumer extends ScheduledPollConsumer and therefore you likely want the endpoint to extend ScheduledPollEndpoint that gives you a lot of scheduling outputs for the consumer.

@davsclaus
Copy link
Contributor

Yeah looks very good. I posted some comments on the code.

@nicolaferraro
Copy link
Member Author

In the meantime, I fixed the other issues.

@davsclaus
Copy link
Contributor

Thank look good.

@oscerd I think you can merge this to the master branch.

@oscerd
Copy link
Contributor

oscerd commented May 21, 2016

@nicolaferraro @davsclaus Merged!

Thanks! :-)

@oscerd
Copy link
Contributor

oscerd commented May 21, 2016

Can you close this PR? Thanks for contribution :-)

@nicolaferraro
Copy link
Member Author

Closed. Thank you guys :D

zregvart pushed a commit to zregvart/camel that referenced this pull request Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants