
# SMN结果表
#### 功能描述
DLI将Flink作业的输出数据输出到消息通知服务（SMN）中。
消息通知服务（Simple Message Notification，简称SMN）为DLI提供可靠的、可扩展的、海量的消息处理服务，它大大简化系统耦合，能够根据用户的需求，向订阅终端主动推送消息。可用于连接云服务、向多个协议推送消息以及集成在产生或使用通知的任何其他应用程序等场景。SMN的更多信息，请参见[《消息通知服务用户指南》](https://support.huaweicloud.com/smn/index.html)。
#### 语法格式
```
create table smnSink (
  attr_name attr_type 
  (',' attr_name attr_type)* 
  (','PRIMARY KEY (attr_name, ...) NOT ENFORCED)
)
with (
  'connector.type' = 'smn',
  'connector.region' = '',
  'connector.topic-urn' = '',
  'connector.message-subject' = '',
  'connector.message-column' = ''
);
```
#### 参数说明
表1参数说明 
| 参数                        | 是否必选 | 说明                                                                                                                                                                 |
|:---|:---|:---|
| connector.type            | 是    | sink的类型，smn表示输出到消息通知服务中                                                                                                                                            |
| connector.region          | 是    | SMN所在区域                                                                                                                                                            |
| connector.topic-urn       | 否    | SMN服务的主题URN，用于静态主题URN配置。作为消息通知的目标主题，需要提前在SMN服务中创建。  与"urn_column"配置两者至少存在一个，同时配置时，"topic_urn"优先级更高。 |
| connector.urn-column      | 否    | 主题URN内容的字段名，用于动态主题URN配置。  与"topic_urn"配置两者至少存在一个，同时配置时，"topic_urn"优先级更高。                         |
| connector.message-subject | 是    | 发送SMN服务的消息标题，用户自定义                                                                                                                                                 |
| connector.message-column  | 是    | 当前表的某个字段名，其内容作为消息的内容，用户自定义。目前只支持默认的文本消息                                                                                                                            |
   
#### 注意事项
无
#### 示例
将数据写入smn的相应主题中，其中smn发送的消息的主题为'test'，内容为字段'attr1'的内容
```
create table smnSink (
  attr1 STRING,
  attr2 STRING
)
with (
  'connector.type' = 'smn',
  'connector.region' = 'cn-north-1',
  'connector.topic-urn' = 'xxxxxx',
  'connector.message-subject' = 'test',
  'connector.message-column' = 'attr1'
);
```
