You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Hussein Baghdadi <hu...@zalando.de> on 2017/03/03 11:03:15 UTC

A Link Sink that writes to OAuth2.0 protected resource

Hello,

In our Sink, we are dealing with a system that uses OAuth 2.0. So the in the open() method of the Sink we are getting the token and then we initialise the client that we can use in order to write from Flink to that API.

Is there a better approach to handle that? 

open() is a lifecycle method which I assume it will be called only once when creating a Sink, correct? Are there any conditions that might trigger open() to be called not upon creations?

Thanks a lot for your help and time.

Re: A Link Sink that writes to OAuth2.0 protected resource

Posted by Stefan Richter <s....@data-artisans.com>.
Hi Hussein,

for your information, today we added a description of task and operator lifecycles to the documentation: https://ci.apache.org/projects/flink/flink-docs-release-1.3/internals/task_lifecycle.html <https://ci.apache.org/projects/flink/flink-docs-release-1.3/internals/task_lifecycle.html> .

Best,
Stefan 

> Am 03.03.2017 um 15:30 schrieb Tzu-Li (Gordon) Tai <tz...@apache.org>:
> 
> Hi Hussein!
> 
> Your approach seems reasonable to me. The open() method will be called only once for the UDF every time the job has started (and when the job is restored from failures also).
> 
> Cheers,
> Gordon
> 
> On March 3, 2017 at 7:03:22 PM, Hussein Baghdadi (hussein.baghdadi@zalando.de <ma...@zalando.de>) wrote:
> 
>> Hello, 
>> 
>> In our Sink, we are dealing with a system that uses OAuth 2.0. So the in the open() method of the Sink we are getting the token and then we initialise the client that we can use in order to write from Flink to that API. 
>> 
>> Is there a better approach to handle that?  
>> 
>> open() is a lifecycle method which I assume it will be called only once when creating a Sink, correct? Are there any conditions that might trigger open() to be called not upon creations? 
>> 
>> Thanks a lot for your help and time.


Re: A Link Sink that writes to OAuth2.0 protected resource

Posted by "Tzu-Li (Gordon) Tai" <tz...@apache.org>.
Hi Hussein!

Your approach seems reasonable to me. The open() method will be called only once for the UDF every time the job has started (and when the job is restored from failures also).

Cheers,
Gordon

On March 3, 2017 at 7:03:22 PM, Hussein Baghdadi (hussein.baghdadi@zalando.de) wrote:

Hello, 

In our Sink, we are dealing with a system that uses OAuth 2.0. So the in the open() method of the Sink we are getting the token and then we initialise the client that we can use in order to write from Flink to that API. 

Is there a better approach to handle that? 

open() is a lifecycle method which I assume it will be called only once when creating a Sink, correct? Are there any conditions that might trigger open() to be called not upon creations? 

Thanks a lot for your help and time.