You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "liufangliang (Jira)" <ji...@apache.org> on 2020/10/27 02:45:00 UTC

[jira] [Comment Edited] (FLINK-18044) Add the subtask index information to the SourceReaderContext.

    [ https://issues.apache.org/jira/browse/FLINK-18044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17133852#comment-17133852 ] 

liufangliang edited comment on FLINK-18044 at 10/27/20, 2:44 AM:
-----------------------------------------------------------------

Hi [~becket_qin],

can i pack this issue?

my solution is to add a methed named indexOfSubtask to interface SourceReaderContext,as following 
{code:java}
/**
 * @return The index of this subtask
 */
int getIndexOfSubtask();{code}
And then ,implement this method in the open() method of class SourceOperator,as following
{code:java}
@Override
public int getIndexOfSubtask(){
   return getRuntimeContext().getIndexOfThisSubtask();

}
{code}
what do you think of it ?

 

 


was (Author: liufangliang):
Hi [~becket_qin],

can i pack this issue?

my solution is to add a methed named indexOfSubtask to interface SourceReaderContext,as following 
{code:java}
/**
 * @return The index of this subtask
 */
int indexOfSubtask();{code}
And then ,implement this method in the open() method of class SourceOperator,as following
{code:java}
@Override
public int indexOfSubtask(){
   return getRuntimeContext().getIndexOfThisSubtask();

}
{code}
what do you think of it ?

 

 

> Add the subtask index information to the SourceReaderContext.
> -------------------------------------------------------------
>
>                 Key: FLINK-18044
>                 URL: https://issues.apache.org/jira/browse/FLINK-18044
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Connectors / Common
>            Reporter: Jiangjie Qin
>            Priority: Major
>              Labels: pull-request-available
>
> It is useful for the `SourceReader` to retrieve its subtask id. For example, Kafka readers can create a consumer with proper client id.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)