文档首页 > > SDK参考> 使用SDK> 使用SDK(C)> 创建无转储任务(源数据类型为BLOB、JSON、CSV)的通道

创建无转储任务(源数据类型为BLOB、JSON、CSV)的通道

分享
更新时间: 2020/03/12 GMT+08:00
// 通道名称
char *pucStreamName = "myStream";
char *projectId = "d575b0b740e54221aeb9a165653b103d";
char *region = "southchina";
char *host = "XXX.XXX.XXX.XXX:XXX";
int ret = 0;
DISResponseInfo RspInfo = { 0 };
DISCreateStream *pstCreateStream = disMemAlloc(sizeof(DISCreateStream));
DISCreateStreamExpend *pstCreateStreamExpend = disMemAlloc(sizeof(DISCreateStreamExpend));
pstCreateStreamExpend->dataType = DISDataTypeBlob;
pstCreateStreamExpend->dataDuration = 2 * 24;

pstCreateStream->partitionCount = 10;
pstCreateStream->streamName = pucStreamName;
pstCreateStream->streamType = DISStreamTypeAdvanced;
pstCreateStream->pucReserved = pstCreateStreamExpend;

printf("===================%s Begin=======================\n", __FUNCTION__);
ret = CreateStream(host, projectId, region, pstCreateStream, &RspInfo);
if (ret != 0)
{
printf("Create Error: %d\r\n", ret);
printf("HttpResponseCode: %ld\r\n", RspInfo.HttpResponseCode);
printf("ErrorCode: %s\r\n", RspInfo.ErrorCode);
printf("ErrorDetail: %s\r\n", RspInfo.ErrorDetail);
}
else
{
printf("Create stream %s success\n", pstCreateStream->streamName);
printf("HttpResponseCode: %ld\r\n", RspInfo.HttpResponseCode);
}

disMemFree(pstCreateStream);
printf("===================%s End=======================\n", __FUNCTION__);

配置“DISCreateStream”对象之后,通过调用CreateStream的方法创建通道。

ret = CreateStream(host, projectId, region, pstCreateStream, &RspInfo);

运行结果

可以在控制台查看到类似如下信息:

Create stream myStream success
HttpResponseCode: 201

分享:

    相关文档

    相关产品

文档是否有解决您的问题?

提交成功!

非常感谢您的反馈,我们会继续努力做到更好!

反馈提交失败,请稍后再试!

*必选

请至少选择或填写一项反馈信息

字符长度不能超过200

提交反馈 取消

如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨

智能客服提问云社区提问