How to Receive a Message from an Apache ActiveMQ Queue with Jekejeke Prolog

foreign(create_connection_factory/1, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', createConnectionFactory),

foreign(create_connection/2, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', createConnection('Object')),

foreign(create_session/4, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', createSession('Object', 'String', 'Integer')),

foreign(create_queue/3, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', createQueue('Object', 'String')),

foreign(create_consumer/3, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', createConsumer('Object', 'Object')),

foreign(start_connection/1, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', startConnection('Object')),

foreign(receive_message/2, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', receiveMessage('Object')),

foreign(print_message/1, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', printMessage('Object')),

foreign(close_connection/1, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', closeConnection('Object')),

create_connection_factory(ConnFactory),

create_connection(ConnFactory, Conn),

create_session(Conn, 'false', 1, Sess),

create_queue(Sess, 'SampleQueue', Dest),

create_consumer(Sess, Dest, Cons),

start_connection(Conn),

receive_message(Cons, Msg),

current_prolog_flag(sys_disp_output, Out),

sys_write(Out, Msg),

close_connection(Conn).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s