hi,
I have met a problem in my project when I want to send msgs from oracle. Maybe it's something about database, I am sorry ,but I do need some advice. Thanks.
It's like this, I want to trigger a message sent to hornetq whenever data is inserted into oracle.
I wrote a trigger, a function and loaded a java file into oracle.
Since I want to make this process as fast as possible, I use a long connection to hornetq instead of reconnecting whenever I send a msg, to implement this ,
a static field is used in the java class, and initialized only once.
The problem I met is , when I insert data into oracle, the insert statement does not stop, although the msg is sent. I don't know what 's going on here.
here is the code : ( i remove the try catch statements to make it short)
Sender.java:
import net.ser1.stomp.Client;
public class Sender{
public static Client client;
static {
client = new Client("10.214.10.90", 61613, "guest", "guest");
}
public static int produce(String msg) {
client.send("jms.queue.testQueue", msg);
return 0;
}
}
function:
language java
name 'Sender.produce(java.lang.String) return int';
trigger:
for each row
declare
my_var varchar2(200);
ret number;
begin
my_var := ..... //make a string here
ret := p(my_var);
end;