Skip to content

Commit b2c6520

Browse files
committed
Refactor code base
1 parent 444891d commit b2c6520

File tree

5 files changed

+30
-18
lines changed

5 files changed

+30
-18
lines changed

examples/ez-food/order-svc/Ballerina.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ filePath = "persist/model.bal"
2222
groupId = "io.ballerina.stdlib"
2323
artifactId = "persist.inmemory-native"
2424
version = "1.6.0"
25-
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.org).
2+
//
3+
// WSO2 LLC. licenses this file to you under the Apache License,
4+
// Version 2.0 (the "License"); you may not use this file except
5+
// in compliance with the License.
6+
// You may obtain a copy of the License at
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing,
11+
// software distributed under the License is distributed on an
12+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
13+
// KIND, either express or implied. See the License for the
14+
// specific language governing permissions and limitations
15+
// under the License.
16+
17+
import ballerinax/java.jms;
18+
19+
const string ORDERS_QUEUE = "orders";
20+
const string ORDER_CONFIRMATIONS_QUEUE = "order-confirmation";
21+
const string ORDER_STATUS_UPDATE_TOPIC = "order-status-update";
22+
23+
configurable jms:ConnectionConfiguration activeMqConnectionConfig = {
24+
initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory",
25+
providerUrl: "tcp://localhost:61616"
26+
};
27+
28+
listener jms:Listener activeMqListener = check new (activeMqConnectionConfig);

examples/ez-food/order-svc/order_confirmation_listener.bal

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,10 @@ import ordersvc.store;
1717

1818
import ballerinax/java.jms;
1919

20-
const string ORDER_CONFIRMATIONS_QUEUE = "order-confirmation";
21-
22-
listener jms:Listener orderConfirmationListener = check new (activeMqConnectionConfig);
23-
2420
@jms:ServiceConfig {
2521
queueName: ORDER_CONFIRMATIONS_QUEUE
2622
}
27-
service "order-confirmation-receiver" on orderConfirmationListener {
23+
service "order-confirmation-receiver" on activeMqListener {
2824
remote function onMessage(jms:Message message) returns error? {
2925
if message !is jms:BytesMessage {
3026
return;

examples/ez-food/order-svc/order_status_listener.bal

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@
1616
import ballerinax/activemq.driver as _;
1717
import ballerinax/java.jms;
1818

19-
const string ORDER_STATUS_UPDATE_TOPIC = "order-status-update";
20-
21-
listener jms:Listener orderStatusListener = check new (activeMqConnectionConfig);
22-
2319
@jms:ServiceConfig {
2420
topicName: ORDER_STATUS_UPDATE_TOPIC,
2521
subscriberName: "order-service-consumer"
2622
}
27-
service "order-status-update-receiver" on orderStatusListener {
23+
service "order-status-update-receiver" on activeMqListener {
2824
remote function onMessage(jms:Message message) returns error? {
2925
if message !is jms:BytesMessage {
3026
return;

examples/ez-food/order-svc/service.bal

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@ isolated function getNextOrderId() returns int {
3131
}
3232
}
3333

34-
const string ORDERS_QUEUE = "orders";
35-
36-
configurable jms:ConnectionConfiguration activeMqConnectionConfig = {
37-
initialContextFactory: "org.apache.activemq.jndi.ActiveMQInitialContextFactory",
38-
providerUrl: "tcp://localhost:61616"
39-
};
40-
4134
final store:Client datastore = check new ();
4235

4336
# A service representing an online food ordering system

0 commit comments

Comments
 (0)