我有以下流程,它将定期发出 REST 请求,然后将数据存储到 PostgreSQL 数据库中。
<jdbc:postgresql-data-source name="PostgreSQL_Data_Source" user="postgres" password="*******" url="jdbc:postgresql://localhost:5432/TestDB" transactionIsolation="UNSPECIFIED" doc:name="PostgreSQL Data Source"/>
<jdbc:connector name="PostgreSQL_JDBC_Connector" dataSource-ref="PostgreSQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<jdbc:query key="InsertRecord" value="INSERT INTO "tblJSON"("StoreHere") VALUES (CAST(#[message.payload] AS json))"/>
</jdbc:connector>
<flow name="RESTServiceScheduling" doc:name="RESTServiceScheduling">
<!-- Step 1: Generates events at a given interval of time -->
<quartz:inbound-endpoint jobName="RESTServiceJobSchedule" repeatInterval="0" doc:name="Quartz" responseTimeout="10000" cronExpression="0 0 10 ? * *">
<quartz:event-generator-job/>
</quartz:inbound-endpoint>
<!-- Step 2: This will read the REST service data -->
<http:rest-service-component httpMethod="GET" serviceUrl="http://localhost:12186/RestServiceImpl.svc/StorageUsage" />
<!-- Step 3: Transform the HTTP-streamed payload into a java.lang.String -->
<object-to-string-transformer doc:name="Object to String"/>
<!-- Step 4: Dump into the destination Database -->
<jdbc:outbound-endpoint exchange-pattern="one-way" queryKey="InsertRecord" queryTimeout="-1" connector-ref="PostgreSQL_JDBC_Connector" doc:name="Destination"/>
</flow>
这工作正常,但我需要一种从 CLI(命令行界面)中触发工作的方法。
我该怎么做?
提前致谢