我们怎样才能invoke c# windows service
(或)dll
从Oracle AFTER INSERT Trigger
调用C#Windows服务AFTER INSERT触发器
文件任何建议将高度赞赏
最好的问候,
我们怎样才能invoke c# windows service
(或)dll
从Oracle AFTER INSERT Trigger
调用C#Windows服务AFTER INSERT触发器
文件任何建议将高度赞赏
最好的问候,
作为一个规则, windows服务并不是针对特定请求调用的,它应该在后台连续运行。
为了让Oracle DB做些事情,你首先需要在你的表上监控插入的触发器。
然后,这应该叫java存储过程。此存储过程然后可以在消息总线上发送消息,该消息可以由您的服务接收并处理。
参见:
Sending a JMS Message from Oracle Database on DML Event
Oracle: Java stored procedure sending JMS Message
https://docs.oracle.com/cd/B19306_01/server.102/b14257/jm_point.htm
另一种方法是获取Java通过将Oracle存储过程调用外部程序
我已经解决了这个问题触发使用utl_http
调用WebApi服务。这样的“服务”可以坐等待请求和触发轻触。以下是我的触发器示例:
declare
content varchar2(4000);
req utl_http.req;
res utl_http.resp;
url varchar2(4000) := 'http://server.com/api/Function';
begin
content := '{ "Message": "Hello" }';
req := utl_http.begin_request(url, 'POST',' HTTP/1.1');
utl_http.set_header(req, 'user-agent', 'mozilla/4.0');
utl_http.set_header(req, 'content-type', 'application/json');
utl_http.set_header(req, 'Content-Length', length(content));
utl_http.write_text(req, content);
res := utl_http.get_response(req);
if res.status_code <> 200 then
dbms_output.put_line(res.reason_phrase);
end if;
utl_http.end_response(res);
end;
您可以将所需的任何逻辑放入WebApi端点。如果你真的想要一个windows服务,你可以让触发器写入类似RabbitMQ的东西,并让服务使用交换队列。
你有什么试过?请提出具体问题并提供代码示例。这里有一个类似的问题:https://stackoverflow.com/questions/14918695/invoke-windows-service-from-oracle-after-insert-trigger –