Simples Assim

How to Receive a Message from an Apache ActiveMQ Topic with OCaml-Java

leave a comment »

W/o Durability

open Java

open JavaString

open Package'java'io

open Package'javax'jms

open Package'org'apache'activemq

let conn_factory = Java.make "ActiveMQConnectionFactory()" ()

let conn = call "ConnectionFactory.createConnection()" conn_factory

let sess = call "Connection.createSession(boolean, int)" conn false (get "Session.AUTO_ACKNOWLEDGE" ())

let dest = call "Session.createTopic(String)" sess (of_string "SampleTopic")

let cons = call "Session.createConsumer(Destination)" sess dest

let _ = call "Connection.start()" conn

let msg = call "MessageConsumer.receive()" cons

let _ = call "PrintStream.println(Object)" (get "System.out" ()) msg

let _ = call "Connection.close()" conn

W/ Durability

open Java

open JavaString

open Package'java'io

open Package'javax'jms

open Package'org'apache'activemq

let conn_factory = Java.make "ActiveMQConnectionFactory()" ()

let conn = call "ConnectionFactory.createConnection()" conn_factory

let _ = call "Connection.setClientID(String)" conn (of_string "SampleClient")

let sess = call "Connection.createSession(boolean, int)" conn false (get "Session.AUTO_ACKNOWLEDGE" ())

let dest = call "Session.createTopic(String)" sess (of_string "SampleTopic")

let cons = call "Session.createDurableSubscriber(Topic, String)" sess dest (of_string "SampleSubscription")

let _ = call "Connection.start()" conn

let msg = call "MessageConsumer.receive()" cons

let _ = call "PrintStream.println(Object)" (get "System.out" ()) msg

let _ = call "Connection.close()" conn

Written by Fernando Ribeiro

February 15, 2015 at 11:22 pm

How to Receive a Message from an Apache ActiveMQ Queue with OCaml-Java

leave a comment »

open Java

open JavaString

open Package'java'io

open Package'javax'jms

open Package'org'apache'activemq

let conn_factory = Java.make "ActiveMQConnectionFactory()" ()

let conn = call "ConnectionFactory.createConnection()" conn_factory

let sess = call "Connection.createSession(boolean, int)" conn false (get "Session.AUTO_ACKNOWLEDGE" ())

let dest = call "Session.createQueue(String)" sess (of_string "SampleQueue")

let cons = call "Session.createConsumer(Destination)" sess dest

let _ = call "Connection.start()" conn

let msg = call "MessageConsumer.receive()" cons

let _ = call "PrintStream.println(Object)" (get "System.out" ()) msg

let _ = call "Connection.close()" conn

Written by Fernando Ribeiro

February 15, 2015 at 11:21 pm

How to Send a Message to an Apache ActiveMQ Topic with OCaml-Java

leave a comment »

open Java

open JavaString

open Package'javax'jms

open Package'org'apache'activemq

let conn_factory = Java.make "ActiveMQConnectionFactory()" ()

let conn = call "ConnectionFactory.createConnection()" conn_factory

let sess = call "Connection.createSession(boolean, int)" conn false (get "Session.AUTO_ACKNOWLEDGE" ())

let dest = call "Session.createTopic(String)" sess (of_string "SampleTopic")

let prod = call "Session.createProducer(Destination)" sess dest

let msg = call "Session.createTextMessage(String)" sess (of_string "Simples Assim")

let _ = call "MessageProducer.send(Message)" prod msg

let _ = call "Connection.close()" conn

Written by Fernando Ribeiro

February 15, 2015 at 11:21 pm

How to Send a Message to an Apache ActiveMQ Queue with OCaml-Java

leave a comment »

open Java

open JavaString

open Package'javax'jms

open Package'org'apache'activemq

let conn_factory = Java.make "ActiveMQConnectionFactory()" ()

let conn = call "ConnectionFactory.createConnection()" conn_factory

let sess = call "Connection.createSession(boolean, int)" conn false (get "Session.AUTO_ACKNOWLEDGE" ())

let dest = call "Session.createQueue(String)" sess (of_string "SampleQueue")

let prod = call "Session.createProducer(Destination)" sess dest

let msg = call "Session.createTextMessage(String)" sess (of_string "Simples Assim")

let _ = call "MessageProducer.send(Message)" prod msg

let _ = call "Connection.close()" conn

Written by Fernando Ribeiro

February 15, 2015 at 11:20 pm

How to Setup the Oracle WebLogic Node Manager to Start the Administration Server

leave a comment »

1) Start the Administration Server.

2) Start the Scripting Tool.

3) Connect to the Administration Server:

connect('username', 'password')

4) Generate the Node Manager configuration files for the Administration Server:

nmGenBootStartupProps('AdminServer')

5) Shutdown the Administration Server:

shutdown()

6) Connect to the Node Manager:

nmConnect(username='username', password='password', domainName='sample_domain')

7) Start the Administration Server:

nmStart('AdminServer')

8) Exit the Scripting Tool:

exit()

9) Change the value of the CrashRecoveryEnabled property in the <WebLogic Server Install Dir>/user_projects/domains/sample_domain/nodemanager/nodemanager.properties file to true.

10) Restart the Node Manager.

You can find more details here.

Written by Fernando Ribeiro

January 29, 2015 at 7:18 pm

How to Setup the Oracle WebLogic Server Node Manager as an Oracle Linux Service

leave a comment »

Written by Fernando Ribeiro

January 29, 2015 at 6:49 pm

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

leave a comment »

W/o Durability

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, 'SampleTopic', Dest),

create_consumer(Sess, Dest, Cons),

start_connection(Conn),

receive_message(Cons, Msg),

print_message(Msg),

close_connection(Conn).

W/ Durability

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(set_client_id/2, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', setClientID('Object', 'String')),

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

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

foreign(create_durable_subscriber/4, 'br.eti.fernandoribeiro.jekpro.activemq.ActiveMQLibrary', createDurableSubscriber('Object', 'Object', 'String')),

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),

set_client_id(Conn, 'SampleClient'),

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

create_topic(Sess, 'SampleTopic', Dest),

create_durable_subscriber(Sess, Dest, 'SampleSubscription', Cons),

start_connection(Conn).

receive_message(Cons, Msg),

print_message(Msg),

close_connection(Conn).

Written by Fernando Ribeiro

January 26, 2015 at 7:17 pm

Follow

Get every new post delivered to your Inbox.

Join 1,254 other followers