From 69382dbaa37697758ac2fd0f1ecce012dcf4e45b Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Fri, 11 Aug 2023 15:18:37 +0530 Subject: [PATCH] Remove non-relevant examples --- .../jms_durable_topic_message_subscriber.bal | 32 ------- ...rable_topic_message_subscriber.description | 2 - .../jms_durable_topic_message_subscriber.out | 9 -- .../jms_headers_and_properties.bal | 50 ----------- .../jms_headers_and_properties.description | 1 - .../jms_headers_and_properties.out | 8 -- .../jms_queue_message_producer.bal | 16 ---- .../jms_queue_message_producer.description | 4 - .../jms_queue_message_producer.out | 7 -- ...ge_receiver_with_client_acknowledgment.bal | 36 -------- ...ver_with_client_acknowledgment.description | 2 - ...ge_receiver_with_client_acknowledgment.out | 10 --- .../jms_queue_message_receiver.bal | 32 ------- .../jms_queue_message_receiver.description | 3 - .../jms_queue_message_receiver.out | 10 --- ...jms_synchronous_queue_message_receiver.bal | 29 ------ ...hronous_queue_message_receiver.description | 1 - ...jms_synchronous_queue_message_receiver.out | 8 -- .../jms_topic_message_producer.bal | 16 ---- .../jms_topic_message_producer.description | 4 - .../jms_topic_message_producer.out | 7 -- .../jms_topic_message_subscriber.bal | 32 ------- .../jms_topic_message_subscriber.description | 2 - .../jms_topic_message_subscriber.out | 8 -- .../send_jms_message_to_http_endpoint.bal | 88 ------------------- ...d_jms_message_to_http_endpoint.description | 3 - .../send_jms_message_to_http_endpoint.out | 8 -- .../transactional_queue_message_producer.bal | 16 ---- ...ctional_queue_message_producer.description | 1 - .../transactional_queue_message_producer.out | 10 --- 30 files changed, 455 deletions(-) delete mode 100644 examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.bal delete mode 100644 examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.description delete mode 100644 examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.out delete mode 100644 examples/jms-headers-and-properties/jms_headers_and_properties.bal delete mode 100644 examples/jms-headers-and-properties/jms_headers_and_properties.description delete mode 100644 examples/jms-headers-and-properties/jms_headers_and_properties.out delete mode 100644 examples/jms-queue-message-producer/jms_queue_message_producer.bal delete mode 100644 examples/jms-queue-message-producer/jms_queue_message_producer.description delete mode 100644 examples/jms-queue-message-producer/jms_queue_message_producer.out delete mode 100644 examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.bal delete mode 100644 examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.description delete mode 100644 examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.out delete mode 100644 examples/jms-queue-message-receiver/jms_queue_message_receiver.bal delete mode 100644 examples/jms-queue-message-receiver/jms_queue_message_receiver.description delete mode 100644 examples/jms-queue-message-receiver/jms_queue_message_receiver.out delete mode 100644 examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.bal delete mode 100644 examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.description delete mode 100644 examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.out delete mode 100644 examples/jms-topic-message-producer/jms_topic_message_producer.bal delete mode 100644 examples/jms-topic-message-producer/jms_topic_message_producer.description delete mode 100644 examples/jms-topic-message-producer/jms_topic_message_producer.out delete mode 100644 examples/jms-topic-message-subscriber/jms_topic_message_subscriber.bal delete mode 100644 examples/jms-topic-message-subscriber/jms_topic_message_subscriber.description delete mode 100644 examples/jms-topic-message-subscriber/jms_topic_message_subscriber.out delete mode 100644 examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.bal delete mode 100644 examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.description delete mode 100644 examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.out delete mode 100644 examples/transactional-queue-message-producer/transactional_queue_message_producer.bal delete mode 100644 examples/transactional-queue-message-producer/transactional_queue_message_producer.description delete mode 100644 examples/transactional-queue-message-producer/transactional_queue_message_producer.out diff --git a/examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.bal b/examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.bal deleted file mode 100644 index 7d4152c7..00000000 --- a/examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.bal +++ /dev/null @@ -1,32 +0,0 @@ -import ballerina/log; -import ballerina/java.jms; - -jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - -listener jms:MessageConsumer jmsConsumer = createListener(connection); - -service messageListener on jmsConsumer { - - resource function onMessage(jms:Message message) { - if (message is jms:TextMessage) { - var val = message.getText(); - if (val is string) { - log:printInfo("Message received: " + val ); - } else { - log:printInfo("Message received without text"); - } - } else { - log:printInfo("Message received."); - } - } -} - -function createListener(jms:Connection connection) returns jms:MessageConsumer { - jms:Session session = checkpanic connection->createSession({acknowledgementMode: "AUTO_ACKNOWLEDGE"}); - jms:Destination topic = checkpanic session->createTopic("MyTopic"); - jms:MessageConsumer jmsConsumer = check session->createDurableSubscriber(topic, "sub-1"); - return jmsConsumer; -} diff --git a/examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.description b/examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.description deleted file mode 100644 index 9e14c78f..00000000 --- a/examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.description +++ /dev/null @@ -1,2 +0,0 @@ -// Ballerina natively supports Java Message Service (JMS). In this example, a simple JMS durable topic subscriber is -// created using a session object. diff --git a/examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.out b/examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.out deleted file mode 100644 index 140f7f08..00000000 --- a/examples/jms-durable-topic-message-subscriber/jms_durable_topic_message_subscriber.out +++ /dev/null @@ -1,9 +0,0 @@ -# Before running the example, start the Artemis message broker. -# Next, copy the artemis-jms-client-.jar and artemis-selector-.jar -# files to the /bre/lib directory. - -# To run this sample, navigate to the directory that contains the -# `.bal` file, and execute the `ballerina run` command. -$ ballerina run jms_durable_topic_message_subscriber.bal -# The JMS subscriber runs as a Ballerina service and listens to the subscribed topic. -2018-06-14 15:03:15,634 INFO [ballerina/jms] - Durable subscriber created for topic BallerinaTopic diff --git a/examples/jms-headers-and-properties/jms_headers_and_properties.bal b/examples/jms-headers-and-properties/jms_headers_and_properties.bal deleted file mode 100644 index 15efd798..00000000 --- a/examples/jms-headers-and-properties/jms_headers_and_properties.bal +++ /dev/null @@ -1,50 +0,0 @@ -import ballerina/log; -import ballerina/java.jms; - -public function main() returns error? { - - jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - jms:Session session = check connection->createSession({acknowledgementMode: "AUTO_ACKNOWLEDGE"}); - jms:Destination queue = check session->createQueue("MyQueue"); - jms:MessageProducer producer = check session.createProducer(queue); - jms:MessageConsumer consumer = check session->createConsumer(queue); - - jms:TextMessage msg = check session.createTextMessage("Hello Ballerina!"); - var headerResult = msg.setJMSCorrelationID("Msg:1"); - var propResult = msg.setStringProperty("Instruction", "Do a perfect Pirouette"); - - check producer->send(msg); - - jms:Message? response = check consumer->receive(3000); - if (response is jms:TextMessage) { - var val = response.getText(); - // print message - if (val is string) { - log:printInfo("Message received: " + val); - } else { - log:printInfo("Message received without text"); - } - - // print message correlationId header - string? correlationId = check response.getJMSCorrelationID(); - if (correlationId is string) { - log:printInfo("Message header correlationId: " + correlationId); - } else { - log:printInfo("Message received without header correlationId"); - } - - // print message string property - string? strProperty = check response.getStringProperty("Instruction"); - if (strProperty is string) { - log:printInfo("Message property: " + strProperty); - } else { - log:printInfo("Message received without property"); - } - - } else { - log:printInfo("Message received."); - } -} diff --git a/examples/jms-headers-and-properties/jms_headers_and_properties.description b/examples/jms-headers-and-properties/jms_headers_and_properties.description deleted file mode 100644 index a551c464..00000000 --- a/examples/jms-headers-and-properties/jms_headers_and_properties.description +++ /dev/null @@ -1 +0,0 @@ -// This example retrieves message headers and properties from a JMS message. diff --git a/examples/jms-headers-and-properties/jms_headers_and_properties.out b/examples/jms-headers-and-properties/jms_headers_and_properties.out deleted file mode 100644 index 6c74061a..00000000 --- a/examples/jms-headers-and-properties/jms_headers_and_properties.out +++ /dev/null @@ -1,8 +0,0 @@ -# Before running this sample, start the Artemis message broker. -# Next, copy the artemis-jms-client-.jar and artemis-selector-.jar -# files to the /bre/lib directory. - -# To run this sample, navigate to the directory that contains the -# `.bal` file, and execute the `ballerina run` command. -$ ballerina run jms_headers_and_properties.bal -2018-06-14 15:14:30,739 INFO [ballerina/jms] - Message receiver created for queue MyQueue diff --git a/examples/jms-queue-message-producer/jms_queue_message_producer.bal b/examples/jms-queue-message-producer/jms_queue_message_producer.bal deleted file mode 100644 index ba115bee..00000000 --- a/examples/jms-queue-message-producer/jms_queue_message_producer.bal +++ /dev/null @@ -1,16 +0,0 @@ -import ballerina/java.jms; - -public function main() returns error? { - - jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - jms:Session session = check connection->createSession({acknowledgementMode: "AUTO_ACKNOWLEDGE"}); - jms:Destination queue = check session->createQueue("MyQueue"); - jms:MessageProducer producer = check session.createProducer(queue); - - jms:TextMessage msg = check session.createTextMessage("Hello Ballerina!"); - - check producer->send(msg); -} diff --git a/examples/jms-queue-message-producer/jms_queue_message_producer.description b/examples/jms-queue-message-producer/jms_queue_message_producer.description deleted file mode 100644 index 9f7ffa7c..00000000 --- a/examples/jms-queue-message-producer/jms_queue_message_producer.description +++ /dev/null @@ -1,4 +0,0 @@ -// In this example, a message is published to a queue using a -// Java Message Service (JMS) publisher. Both the connection and session are -// created explicitly to allow reusability. - diff --git a/examples/jms-queue-message-producer/jms_queue_message_producer.out b/examples/jms-queue-message-producer/jms_queue_message_producer.out deleted file mode 100644 index dc0ef6a8..00000000 --- a/examples/jms-queue-message-producer/jms_queue_message_producer.out +++ /dev/null @@ -1,7 +0,0 @@ -# Before running the sample, start the Artemis message broker. -# Next, copy the artemis-jms-client-.jar and artemis-selector-.jar -# files to the /bre/lib directory. - -# To run this sample, navigate to the directory that contains the -# `.bal` file, and execute the `ballerina run` command. -$ ballerina run jms_queue_message_producer.bal diff --git a/examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.bal b/examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.bal deleted file mode 100644 index 5f56400d..00000000 --- a/examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.bal +++ /dev/null @@ -1,36 +0,0 @@ -import ballerina/log; -import ballerina/java.jms; - -jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - -listener jms:MessageConsumer jmsConsumer = createListener(connection); - -service messageListener on jmsConsumer { - - resource function onMessage(jms:Message message) { - if (message is jms:TextMessage) { - var val = message.getText(); - if (val is string) { - log:printInfo("Message received: " + val ); - } else { - log:printInfo("Message received without text"); - } - var result = message->acknowledge(); - if (result is error) { - log:printError("Error occurred while acknowledging message", err = result); - } - } else { - log:printInfo("Message received."); - } - } -} - -function createListener(jms:Connection connection) returns jms:MessageConsumer { - jms:Session session = check connection->createSession({acknowledgementMode: "CLIENT_ACKNOWLEDGE"}); - jms:Destination queue = check session->createQueue("MyQueue"); - jms:MessageConsumer jmsConsumer = checkpanic session->createConsumer(queue); - return jmsConsumer; -} diff --git a/examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.description b/examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.description deleted file mode 100644 index bed17ab2..00000000 --- a/examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.description +++ /dev/null @@ -1,2 +0,0 @@ -// Ballerina natively supports Java Message Service (JMS). In this example, a simple JMS queue -// receiver is created with a client acknowledgment. diff --git a/examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.out b/examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.out deleted file mode 100644 index 9393426a..00000000 --- a/examples/jms-queue-message-receiver-with-client-acknowledgment/jms_queue_message_receiver_with_client_acknowledgment.out +++ /dev/null @@ -1,10 +0,0 @@ -# Before running the example, start the Artemis message broker. -# Next, copy the artemis-jms-client-.jar and artemis-selector-.jar -# files to the /bre/lib directory. - -# Navigate to the directory that contains the -# 'jms_queue_message_receiver_with_client_acknowledgment.bal' file, and execute the 'ballerina run' command. -$ ballerina run jms_queue_message_receiver_with_client_acknowledgment.bal - -# The JMS queue receiver runs as a Ballerina service and listens to the subscribed queue. -2018-06-14 15:22:13,061 INFO [ballerina/jms] - Message receiver created for queue MyQueue diff --git a/examples/jms-queue-message-receiver/jms_queue_message_receiver.bal b/examples/jms-queue-message-receiver/jms_queue_message_receiver.bal deleted file mode 100644 index 561ec999..00000000 --- a/examples/jms-queue-message-receiver/jms_queue_message_receiver.bal +++ /dev/null @@ -1,32 +0,0 @@ -import ballerina/log; -import ballerina/java.jms; - -jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - -listener jms:MessageConsumer jmsConsumer = createListener(connection); - -service messageListener on jmsConsumer { - - resource function onMessage(jms:Message message) { - if (message is jms:TextMessage) { - var val = message.getText(); - if (val is string) { - log:printInfo("Message received: " + val ); - } else { - log:printInfo("Message received without text"); - } - } else { - log:printInfo("Message received."); - } - } -} - -function createListener(jms:Connection connection) returns jms:MessageConsumer { - jms:Session session = checkpanic connection->createSession({acknowledgementMode: "AUTO_ACKNOWLEDGE"}); - jms:Destination queue = checkpanic session->createQueue("MyQueue"); - jms:MessageConsumer consumer = checkpanic session->createConsumer(queue); - return consumer; -} diff --git a/examples/jms-queue-message-receiver/jms_queue_message_receiver.description b/examples/jms-queue-message-receiver/jms_queue_message_receiver.description deleted file mode 100644 index c0ee3a5f..00000000 --- a/examples/jms-queue-message-receiver/jms_queue_message_receiver.description +++ /dev/null @@ -1,3 +0,0 @@ -// Natively, Ballerina supports Java Message Service (JMS). In this example, -// a JMS queue receiver is created. Both the Connection and Session are created -// explicitly to allow reusability. diff --git a/examples/jms-queue-message-receiver/jms_queue_message_receiver.out b/examples/jms-queue-message-receiver/jms_queue_message_receiver.out deleted file mode 100644 index 1454ccbd..00000000 --- a/examples/jms-queue-message-receiver/jms_queue_message_receiver.out +++ /dev/null @@ -1,10 +0,0 @@ -# Before running the example, start the Artemis message broker. -# Next, copy the artemis-jms-client-.jar and artemis-selector-.jar -# files to the /bre/lib directory. - -# Navigate to the directory that contains the -# 'jms_queue_message_receiver.bal' file, and execute the 'ballerina run' command. -$ ballerina run jms_queue_message_receiver.bal -# The JMS subscriber runs as a Ballerina service and listens to the subscribed queue -# or topic. -2018-06-14 15:20:04,750 INFO [ballerina/jms] - Message receiver created for queue MyQueue diff --git a/examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.bal b/examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.bal deleted file mode 100644 index f87d8894..00000000 --- a/examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.bal +++ /dev/null @@ -1,29 +0,0 @@ -import ballerina/log; -import ballerina/java.jms; - -public function main() returns error? { - - jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - jms:Session session = check connection->createSession({acknowledgementMode: "AUTO_ACKNOWLEDGE"}); - jms:Destination queue = check session->createQueue("MyQueue"); - jms:MessageProducer producer = check session.createProducer(queue); - jms:MessageConsumer consumer = check session->createConsumer(queue); - - jms:TextMessage msg = check session.createTextMessage("Hello Ballerina!"); - check producer->send(msg); - - jms:Message? response = check consumer->receive(3000); - if (response is jms:TextMessage) { - var val = response.getText(); - if (val is string) { - log:printInfo("Message received: " + val); - } else { - log:printInfo("Message received without text"); - } - } else { - log:printInfo("Message received."); - } -} diff --git a/examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.description b/examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.description deleted file mode 100644 index 536d8191..00000000 --- a/examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.description +++ /dev/null @@ -1 +0,0 @@ -// In this example, a message from a Java Message Service (JMS) queue is consumed in a blocking manner. diff --git a/examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.out b/examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.out deleted file mode 100644 index 1444c598..00000000 --- a/examples/jms-synchronous-queue-message-receiver/jms_synchronous_queue_message_receiver.out +++ /dev/null @@ -1,8 +0,0 @@ -# Before running this example, start the Artemis message broker. -# Next, copy the artemis-jms-client-.jar and artemis-selector-.jar -# files to the /bre/lib directory. - -# Navigate to the directory that contains the -# 'jms_synchronous_queue_message_receiver.bal' file, and execute the 'ballerina run' command. -$ ballerina run jms_synchronous_queue_message_receiver.bal -2018-06-14 15:31:51,884 INFO [ballerina/jms] - Message receiver created for queue MyQueue diff --git a/examples/jms-topic-message-producer/jms_topic_message_producer.bal b/examples/jms-topic-message-producer/jms_topic_message_producer.bal deleted file mode 100644 index 766cbc78..00000000 --- a/examples/jms-topic-message-producer/jms_topic_message_producer.bal +++ /dev/null @@ -1,16 +0,0 @@ -import ballerina/java.jms; - -public function main() returns error? { - - jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - jms:Session session = check connection->createSession({acknowledgementMode: "AUTO_ACKNOWLEDGE"}); - jms:Destination topic = check session->createTopic("MyTopic"); - jms:MessageProducer producer = check session.createProducer(topic); - - jms:TextMessage msg = check session.createTextMessage("Hello Ballerina!"); - - check producer->send(msg); -} diff --git a/examples/jms-topic-message-producer/jms_topic_message_producer.description b/examples/jms-topic-message-producer/jms_topic_message_producer.description deleted file mode 100644 index 121f8843..00000000 --- a/examples/jms-topic-message-producer/jms_topic_message_producer.description +++ /dev/null @@ -1,4 +0,0 @@ -// In this example, a message is published to a topic using a Java Message -// Service (JMS) publisher. Both the connection and session are created explicitly -// to allow reusability. - diff --git a/examples/jms-topic-message-producer/jms_topic_message_producer.out b/examples/jms-topic-message-producer/jms_topic_message_producer.out deleted file mode 100644 index 2712d01b..00000000 --- a/examples/jms-topic-message-producer/jms_topic_message_producer.out +++ /dev/null @@ -1,7 +0,0 @@ -# Before running the example, start the Artemis message broker. -# Next, copy the artemis-jms-client-.jar and artemis-selector-.jar -# files to the /bre/lib directory. - -# Navigate to the directory that contains the -# 'jms_topic_message_producer.bal' file, and execute the 'ballerina run' command. -$ ballerina run jms_topic_message_producer.bal diff --git a/examples/jms-topic-message-subscriber/jms_topic_message_subscriber.bal b/examples/jms-topic-message-subscriber/jms_topic_message_subscriber.bal deleted file mode 100644 index fb99c84d..00000000 --- a/examples/jms-topic-message-subscriber/jms_topic_message_subscriber.bal +++ /dev/null @@ -1,32 +0,0 @@ -import ballerina/log; -import ballerina/java.jms; - -jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - -listener jms:MessageConsumer jmsConsumer = createListener(connection); - -service messageListener on jmsConsumer { - - resource function onMessage(jms:Message message) { - if (message is jms:TextMessage) { - var val = message.getText(); - if (val is string) { - log:printInfo("Message received: " + val ); - } else { - log:printInfo("Message received without text"); - } - } else { - log:printInfo("Message received."); - } - } -} - -function createListener(jms:Connection connection) returns jms:MessageConsumer { - jms:Session session = checkpanic connection->createSession({acknowledgementMode: "AUTO_ACKNOWLEDGE"}); - jms:Destination topic = checkpanic session->createTopic("MyTopic"); - jms:MessageConsumer jmsConsumer = checkpanic session->createConsumer(topic); - return jmsConsumer; -} diff --git a/examples/jms-topic-message-subscriber/jms_topic_message_subscriber.description b/examples/jms-topic-message-subscriber/jms_topic_message_subscriber.description deleted file mode 100644 index cd653ca1..00000000 --- a/examples/jms-topic-message-subscriber/jms_topic_message_subscriber.description +++ /dev/null @@ -1,2 +0,0 @@ -// Ballerina natively supports Java Message Service (JMS). In this example, a JMS topic subscriber is created using a -// session object. diff --git a/examples/jms-topic-message-subscriber/jms_topic_message_subscriber.out b/examples/jms-topic-message-subscriber/jms_topic_message_subscriber.out deleted file mode 100644 index 5f2533ac..00000000 --- a/examples/jms-topic-message-subscriber/jms_topic_message_subscriber.out +++ /dev/null @@ -1,8 +0,0 @@ -# Start the Artemis message broker. -# Copy the artemis-jms-client-.jar and artemis-selector-.jar files to the /bre/lib directory. - -# Navigate to the directory that contains the 'jms_topic_message_subscriber.bal' file, and issue the -# 'ballerina run' command. -$ ballerina run jms_topic_message_subscriber.bal -#The JMS subscriber runs as a Ballerina service and listens to the subscribed topic. -2018-06-14 15:36:38,231 INFO [ballerina/jms] - Subscriber created for topic BallerinaTopic diff --git a/examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.bal b/examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.bal deleted file mode 100644 index 549c8b01..00000000 --- a/examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.bal +++ /dev/null @@ -1,88 +0,0 @@ -import ballerina/http; -import ballerina/log; -import ballerina/java.jms; - -jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - -listener jms:MessageConsumer jmsConsumer = createListener(connection); - -service messageListener on jmsConsumer { - - resource function onMessage(jms:Message message) { - if (message is jms:TextMessage) { - var val = message.getText(); - if (val is string) { - log:printInfo("Message received: " + val + " and forwarding to HTTP endpoint"); - forwardToBakend(<@untainted> val); - } else { - log:printInfo("Message received without text"); - } - } else { - log:printInfo("Message received."); - } - } -} - -function forwardToBakend(string textContent) { - // Create an HTTP client endpoint. - http:Client clientEP = new("http://localhost:9090/"); - - // Forward the received text content of the JMS message to the backend Service - // using the HTTP client endpoint. - http:Request req = new; - req.setPayload(textContent); - var result = clientEP->post("/backend/jms", req); - if (result is http:Response) { - var responseMessage = result.getTextPayload(); - if (responseMessage is string) { - log:printInfo("Response from backend service: " - + responseMessage); - } else { - log:printError("Error while reading response", - err = responseMessage); - } - } else { - log:printError("Error while sending payload", err = result); - } -} - -// Backend service that receive the forwarded message from the broker. -service backend on new http:Listener(9090) { - - @http:ResourceConfig { - methods: ["POST"], - path: "/jms" - } - resource function jmsPayloadReceiver(http:Caller caller, http:Request req) { - http:Response res = new; - - var stringPayload = req.getTextPayload(); - if (stringPayload is string) { - log:printInfo("Message received from backend service. " - + "Payload: " + stringPayload); - - // A util method that can be used to set `string` payload. - res.setPayload("Message Received."); - - // Sends the response back to the client. - var result = caller->respond(res); - - if (result is error) { - log:printError("Error occurred while acknowledging message", - err = result); - } - } else { - log:printError("Error while reading payload", err = stringPayload); - } - } -} - -function createListener(jms:Connection connection) returns jms:MessageConsumer { - jms:Session session = checkpanic connection->createSession({acknowledgementMode: "AUTO_ACKNOWLEDGE"}); - jms:Destination queue = checkpanic session->createQueue("MyQueue"); - jms:MessageConsumer jmsConsumer = checkpanic session->createConsumer(queue); - return jmsConsumer; -} diff --git a/examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.description b/examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.description deleted file mode 100644 index fe48cbe2..00000000 --- a/examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.description +++ /dev/null @@ -1,3 +0,0 @@ -// This example shows how to send a JMS message, consumed by the JMS listener service, -// to an HTTP endpoint. A text payload from the JMS broker is expected and that payload is then -// forwarded to an HTTP endpoint. diff --git a/examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.out b/examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.out deleted file mode 100644 index d1458d73..00000000 --- a/examples/send-jms-message-to-http-endpoint/send_jms_message_to_http_endpoint.out +++ /dev/null @@ -1,8 +0,0 @@ -# Start the Artemis message broker. -# Copy the artemis-jms-client-.jar and artemis-selector-.jar files to the /bre/lib directory. - -# To start the service, navigate to the directory that contains the -# `.bal` file, and use the `ballerina run` command. -$ ballerina run send_jms_message_to_http_endpoint.bal -2018-06-14 15:43:04,283 INFO [ballerina/jms] - Message receiver created for queue MyQueue -ballerina: started HTTP/WS endpoint 0.0.0.0:9090 diff --git a/examples/transactional-queue-message-producer/transactional_queue_message_producer.bal b/examples/transactional-queue-message-producer/transactional_queue_message_producer.bal deleted file mode 100644 index d18145a5..00000000 --- a/examples/transactional-queue-message-producer/transactional_queue_message_producer.bal +++ /dev/null @@ -1,16 +0,0 @@ -import ballerina/java.jms; - -public function main() returns error? { - - jms:Connection connection = check jms:createConnection({ - initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory", - providerUrl: "tcp://localhost:61616" - }); - jms:Session session = check connection->createSession({acknowledgementMode: "SESSION_TRANSACTED"}); - jms:Destination queue = check session->createQueue("MyQueue"); - jms:MessageProducer producer = check session.createProducer(queue); - transaction { - jms:TextMessage msg = check session.createTextMessage("Hello Ballerina!"); - check producer->send(msg); - } -} diff --git a/examples/transactional-queue-message-producer/transactional_queue_message_producer.description b/examples/transactional-queue-message-producer/transactional_queue_message_producer.description deleted file mode 100644 index 2d083cf3..00000000 --- a/examples/transactional-queue-message-producer/transactional_queue_message_producer.description +++ /dev/null @@ -1 +0,0 @@ -// In this example, you publish a message to a queue within a transaction using a Java Message Service (JMS) publisher. diff --git a/examples/transactional-queue-message-producer/transactional_queue_message_producer.out b/examples/transactional-queue-message-producer/transactional_queue_message_producer.out deleted file mode 100644 index 5ceb8cec..00000000 --- a/examples/transactional-queue-message-producer/transactional_queue_message_producer.out +++ /dev/null @@ -1,10 +0,0 @@ -# Start the Artemis message broker. -# Copy the artemis-jms-client-.jar and artemis-selector-.jar files to the /bre/lib directory. - -# To start the service, navigate to the directory that contains the -# `.bal` file, and use the `ballerina run --experimental` command (since this is an experimental feature). -$ ballerina run --experimental transactional_queue_message_producer.bal -ballerina: started HTTP/WS endpoint 172.17.0.1:40769 -2018-06-14 15:38:51,269 INFO [ballerina/transactions] - Created transaction: 982a22d9-cb0f-4f41-aaed-1a9351702dbb -2018-06-14 15:38:51,283 INFO [ballerina/transactions] - Running 2-phase commit for transaction: 982a22d9-cb0f-4f41-aaed-1a9351702dbb:1 -ballerina: stopped HTTP/WS endpoint 172.17.0.1:40769