你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

KafkaOutput 接口

public interface KafkaOutput

KafkaOutput (name = “event”, topic = “users”, brokerList=“broker:29092”) OutputBinding<String<output, final ExecutionContext context) { context.getLogger () .info (“Message:” + message) ;output.setValue (消息) ;return “{ \”id“: ”“ + System.currentTimeMillis () + ”“, ”description“: ”“ + message + ”“ }”; }

方法摘要

修饰符和类型 方法和描述
BrokerAuthenticationMode authenticationMode()

用于身份验证的 SASL 机制。 默认值:PLAIN

int batchSize()

定义一个 MessageSet 中批处理的最大消息数。 默认值:10000

String brokerList()

定义 BrokerList。

String dataType()

定义 Functions 运行时应如何处理参数值。 可能的值为:

    <li>
    
      <p>"" or string: treat it as a string whose value is serialized from the parameter </p>
    
    </li>
    
    <li>
    
      <p>binary: treat it as a binary data whose value comes from for example OutputBinding&lt;byte[]&lt;</p>
    
    </li>
    

boolean enableIdempotence()

设置为“true”时,生成者将确保仅按原始生成顺序成功生成消息一次。 默认值:false

int maxMessageBytes()

定义最大传输消息大小。 默认值:1MB

int maxRetries()

重试发送失败消息的次数。 **注意:**默认值:2 重试可能会导致重新排序,除非 EnableIdempotence 设置为 true。

int messageTimeoutMs()

本地消息超时。 此值仅在本地强制执行,并限制生成的消息等待成功传递的时间。 时间 0 是无限的。 这是用于传递消息(包括重试)的最长时间。 超过重试计数或消息超时时,会发生传递错误。 默认值:300000

String name()

function.json 中使用的变量名称。

String password()

使用 PLAIN 和 SASL-SCRAM 的 SASL 密码-.. 机制默认值为纯文本

librdkafka 中的 security.protocol

BrokerProtocol protocol()

获取或设置用于与代理通信的安全协议默认为 PLAINTEXT

int requestTimeoutMs()

生成者请求的确认超时(以毫秒为单位)。 默认值:5000

String sslCaLocation()

用于验证代理证书的 CA 证书文件的路径。 librdkafka 中的 ssl.ca.location

String sslCertificateLocation()

客户端证书的路径。 librdkafka 中的 ssl.certificate.location

String sslKeyLocation()

用于身份验证的客户端私钥 (PEM) 的路径。 librdkafka 中的默认“”ssl.key.location

String sslKeyPassword()

客户端证书的密码。 librdkafka 中的 ssl.key.password

String topic()

定义主题。

String username()

带有 PLAIN 和 SASL-SCRAM 的 SASL 用户名-.. 机制默认值:“”

方法详细信息

authenticationMode

public BrokerAuthenticationMode authenticationMode() default BrokerAuthenticationMode.NOTSET

用于身份验证的 SASL 机制。 默认值:PLAIN

返回:

SASL 机制。

batchSize

public int batchSize() default 10000

定义一个 MessageSet 中批处理的最大消息数。 默认值:10000

返回:

一个 MessageSet 中批处理的最大消息数。

brokerList

public String brokerList()

定义 BrokerList。

返回:

brokerList 名称字符串。

dataType

public String dataType() default ""

定义 Functions 运行时应如何处理参数值。 可能的值为:

    <li>
    
      <p>"" or string: treat it as a string whose value is serialized from the parameter </p>
    
    </li>
    
    <li>
    
      <p>binary: treat it as a binary data whose value comes from for example OutputBinding&lt;byte[]&lt;</p>
    
    </li>
    

返回:

将由 Functions 运行时使用的 dataType。

enableIdempotence

public boolean enableIdempotence() default false

设置为“true”时,生成者将确保仅按原始生成顺序成功生成消息一次。 默认值:false

返回:

是否启用了幂等性。

maxMessageBytes

public int maxMessageBytes() default 1000012

定义最大传输消息大小。 默认值:1MB

返回:

最大消息大小。

maxRetries

public int maxRetries() default 2

重试发送失败消息的次数。 **注意:**默认值:2 重试可能会导致重新排序,除非 EnableIdempotence 设置为 true。

返回:

最大重试次数。

messageTimeoutMs

public int messageTimeoutMs() default 300000

本地消息超时。 此值仅在本地强制执行,并限制生成的消息等待成功传递的时间。 时间 0 是无限的。 这是用于传递消息(包括重试)的最长时间。 超过重试计数或消息超时时,会发生传递错误。 默认值:300000

返回:

本地消息超时。

name

public String name()

function.json 中使用的变量名称。

返回:

function.json 中使用的变量名称。

password

public String password() default ""

使用 PLAIN 和 SASL-SCRAM 的 SASL 密码-.. 机制默认值为纯文本

librdkafka 中的 security.protocol

返回:

SASL 密码。

protocol

public BrokerProtocol protocol() default BrokerProtocol.NOTSET

获取或设置用于与代理通信的安全协议默认为 PLAINTEXT

返回:

协议。

requestTimeoutMs

public int requestTimeoutMs() default 5000

生成者请求的确认超时(以毫秒为单位)。 默认值:5000

返回:

生成者请求的确认超时(以毫秒为单位)。

sslCaLocation

public String sslCaLocation() default ""

用于验证代理证书的 CA 证书文件的路径。 librdkafka 中的 ssl.ca.location

返回:

ssl ca 位置。

sslCertificateLocation

public String sslCertificateLocation() default ""

客户端证书的路径。 librdkafka 中的 ssl.certificate.location

返回:

ssl 证书位置。

sslKeyLocation

public String sslKeyLocation() default ""

用于身份验证的客户端私钥 (PEM) 的路径。 librdkafka 中的默认“”ssl.key.location

返回:

ssl 密钥位置。

sslKeyPassword

public String sslKeyPassword() default ""

客户端证书的密码。 librdkafka 中的 ssl.key.password

返回:

ssl 密钥密码。

topic

public String topic()

定义主题。

返回:

主题名称。

username

public String username() default ""

带有 PLAIN 和 SASL-SCRAM 的 SASL 用户名-.. 机制默认值:“”

返回:

SASL 用户名。

适用于