斯潘8
span4
在FME服务器中,您可以使用通知服务在事件发生时以消息的形式将数据推入和推出FME服务器。This can be achieved by defining a topic,设置订阅并查看通知。有关通知服务如何工作的详细信息,请查看文档.
A topic gives publishers a target for sending notifications to and gives subscribers a source to receive notifications from.可以使用以下步骤定义主题:
1。打开FME服务器Web用户界面,网址为http:///
2。单击通知>主题>新建。
三。为主题命名,如notificationtutorial,and optionally a description.
4.Click OK to create the topic.
At this point,您可以开始向新主题发送通知,but there is no subscription setup to accept the notification messages.
可以使用FME服务器REST API或FMeserver通知程序transformer.In most cases,a publication (defined in the Web User Interface) will send a message to a topic.然而,the Test Topic option can be used when developing the solution:
1。Click Notifications > Topics.
2。选择您以前创建的主题,通知教程,然后单击测试主题。
三。Enter some text to send in a notification message and click OK.
测试通知教程主题
常见的消息格式包括XML和JSON。检查和理解通知消息的内容是能够构建可处理通知的工作区的关键。
Messages can be inspected using the Topic Monitoring ability in the Web User Interface:
1。In a new browser window/tab,open Notifications > Topic Monitoring,this window needs to stay open for Topic Monitoring to continue running.
2。Select the topic you want to monitor,通知教程,and click the play buttonto start monitoring the topic.Any messages sent to the topic will be displayed.
4.在不同的窗口/选项卡中,go to Notifications > Topics and use the Test Topic option mentioned previously to send a message.
主题监控中的测试主题消息
FME工作区用于处理通知消息。What you do with the message is up to you.您可以将其写入数据库。你可以把它转给其他服务机构。You could tweet the message.You could compare it to other data and decide to take an action.You are only limited by your imagination.
要创建工作区,您需要一个示例消息,该消息可以在整个工作区的Transformers中使用——该消息通常是JSON或XML。A quick way to generate the sample message is to use Topic Monitoring,前面提到过,or you can copy a sample from somewhere else,and then save the sample message into a text file.
要处理这些消息,您需要执行以下步骤:
1。In FME Workbench,打开CreateNotification.fmwt并跳到步骤5或创建一个新的工作区,使用文本文件阅读器读取示例通知消息。确保将文本文件读取器参数“立即读取整个文件”设置为“是”。
文本文件读取器参数
2。默认发布源数据集路径;leave it published.这将允许您将消息从主题映射到工作区。
三。如果您的通知消息是JSON或XML格式,然后你可以使用JSONFlattener或XML扁平化器将层次模型转换为关系模型(即特性)并公开创建的属性。
4.Add in any additional transformers you want and a writer if required.
5.Publish the workspace to FME Server in a repository called "training" and call the workspace "NotificationWorkspace".There are two options for setting up Registered Services:
在通知服务中注册时订阅的命名约定
To have the workspace process messages you need to create a workspace subscription:
1。单击管理通知>订阅。
2。Click New to create a new subscription.Give it a name such as NotificationSubscription.
三。Under Protocol,选择FME工作区。
4.选择您先前定义的主题,通知教程,订阅参数的主题。
Set up the Subscription name,协议和主题
5.在协议设置下,将存储库设置为“培训”,将工作区设置为“通知教程”。Ensure that Get Value from Topic Message is enabled.
Set up the repository,工作区并确保已启用从主题消息获取值
6.Click OK to create the subscription.订阅将作为notificationsubscription列出。
1。使用测试主题选项发送消息
正在测试订阅
2。Check the Jobs page to confirm that the workspace ran successfully.设置订阅时,这两个选项1或2的结果相同。
在“作业”页中成功运行工作区
Results of the test logged by the logger in the NotificationWorkspace.fmw job log
Congratulations!您现在已成功创建了一个订阅,该订阅将在触发特定主题时运行工作区!
Sending email,第1部分:设置主题和电子邮件订户(2015年)
Receiving email,第1部分:设置主题和电子邮件地址(2015年)
Subscribe,Report and Notify Tutorial - 2.Spatial Business Rules (2014)
Subscribe,报告并通知:3.Subscribe and Unsubscribe
工作区通知,Part 3: Completion notification (2015)
Streaming features from PostGIS to Amazon SQS - Process in FME
Subscribe,Report and Notify Tutorial - 1.Database-Backed Subscriptions (2014)
Sending email,第5部分:发送带附件的电子邮件(2015年)
工作区通知,Part 2: Configuring the default subscribers (2016)
Sending email,Part 2: Sending an email using the FMEServerNotifier (2015)
© 2019 亚搏在线Safe Software Inc |合法的