Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions workshops/oracleAQ/qJava/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.examples</groupId>
<artifactId>aqJava</artifactId>
<artifactId>qJava</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>java</name>
<description>AQ workshop </description>
<description>AQ/TxEventQ java workshop </description>
<properties>
<java.version>8</java.version>
<version.lib.ojdbc>21.1.0.0</version.lib.ojdbc>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class ConstantName {

//AQ- Point to Point
public String aq_createTable = "JAVA_QUEUE_TABLE";
public String aq_creaTxEventQueue = "JAVA_QUEUE";
public String aq_createQueue = "JAVA_QUEUE";

public String aq_enqueueDequeueTable= "JAVA_ENQUEUE_DEQUEUE_QUEUE_TABLE";
public String aq_enqueueDequeueQueue= "JAVA_ENQUEUE_DEQUEUE_QUEUE";
Expand All @@ -22,8 +22,8 @@ public class ConstantName {
public String aq_pubSubSubscriber1 = "JAVA_AQ_PUBSUB_SUBSCRIBER1";

//TxEventQ- PUBSUB
public String TxEventQ_pubSubQueue = "JAVA_TxEventQ_PUBSUB_QUEUE";
public String TxEventQ_pubSubSubscriber1 = "JAVA_TxEventQ_PUBSUB_SUBSCRIBER1";
public String txEventQ_pubSubQueue = "JAVA_TxEventQ_PUBSUB_QUEUE";
public String txEventQ_pubSubSubscriber1 = "JAVA_TxEventQ_PUBSUB_SUBSCRIBER1";

//AQ- WORKFLOW
public String aq_userQueueTable = "JAVA_AQ_USER_QUEUE_TABLE";
Expand All @@ -42,17 +42,17 @@ public class ConstantName {
public String aq_applicationDelivererSubscriber = "JAVA_AQ_APPLICATION_DELIVERER_SUBS";

//TxEventQ- WORKFLOW
public String TxEventQ_userQueueName = "JAVA_TxEventQ_USER_QUEUE";
public String TxEventQ_userApplicationSubscriber = "JAVA_TxEventQ_USER_APPLICATION_SUBS";
public String TxEventQ_userDelivererSubscriber = "JAVA_TxEventQ_USER_DELIVERER_SUBS";
public String txEventQ_userQueueName = "JAVA_TxEventQ_USER_QUEUE";
public String txEventQ_userApplicationSubscriber = "JAVA_TxEventQ_USER_APPLICATION_SUBS";
public String txEventQ_userDelivererSubscriber = "JAVA_TxEventQ_USER_DELIVERER_SUBS";

public String TxEventQ_delivererQueueName = "JAVA_TxEventQ_DELIVERER_QUEUE";
public String TxEventQ_delivererApplicationSubscriber= "JAVA_TxEventQ_DELIVERER_APPLICATION_SUBS";
public String TxEventQ_delivererUserSubscriber = "JAVA_TxEventQ_DELIVERER_USER_SUBS";
public String txEventQ_delivererQueueName = "JAVA_TxEventQ_DELIVERER_QUEUE";
public String txEventQ_delivererApplicationSubscriber= "JAVA_TxEventQ_DELIVERER_APPLICATION_SUBS";
public String txEventQ_delivererUserSubscriber = "JAVA_TxEventQ_DELIVERER_USER_SUBS";

public String TxEventQ_applicationQueueName = "JAVA_TxEventQ_APPLICATION_QUEUE";
public String TxEventQ_applicationUserSubscriber = "JAVA_TxEventQ_APPLICATION_USER_SUBS";
public String TxEventQ_applicationDelivererSubscriber= "JAVA_TxEventQ_APPLICATION_DELIVERER_SUBS";
public String txEventQ_applicationQueueName = "JAVA_TxEventQ_APPLICATION_QUEUE";
public String txEventQ_applicationUserSubscriber = "JAVA_TxEventQ_APPLICATION_USER_SUBS";
public String txEventQ_applicationDelivererSubscriber= "JAVA_TxEventQ_APPLICATION_DELIVERER_SUBS";


}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import org.springframework.web.bind.annotation.RestController;

import com.examples.enqueueDequeueAQ.EnqueueDequeueAQ;
import com.examples.enqueueDequeueTEQ.EnqueueDequeueTEQ;
import com.examples.enqueueDequeueTxEventQ.EnqueueDequeueTxEventQ;
import com.examples.workflowAQ.WorkflowAQ;
import com.examples.workflowTEQ.WorkflowTEQ;
import com.examples.workflowTxEventQ.WorkflowTxEventQ;

@RequestMapping("/oracleAQ")
@RestController
Expand All @@ -23,13 +23,13 @@ public class OracleAQController {
EnqueueDequeueAQ enqueueDequeueAQ;

@Autowired(required = true)
EnqueueDequeueTEQ enqueueDequeueTEQ;
EnqueueDequeueTxEventQ enqueueDequeueTxEventQ;

@Autowired(required = true)
WorkflowAQ workflowAQ;

@Autowired(required = true)
WorkflowTEQ workflowTEQ;
WorkflowTxEventQ workflowTxEventQ;

@GetMapping(value = "/pointToPointAQ")
public Map<String, Object> pointToPointAQ() throws Exception {
Expand Down Expand Up @@ -67,21 +67,21 @@ public Map<String, Object> pubSubAQ() throws Exception {
return response;
}

@GetMapping(value = "/pubSubTEQ")
public Map<String, Object> pubSubTEQ() throws Exception {
@GetMapping(value = "/pubSubTxEventQ")
public Map<String, Object> pubSubTxEventQ() throws Exception {
Map<String, Object> response = new HashMap();
Map<Integer, String> responseBody= enqueueDequeueTEQ.pubSubTEQ();
Map<Integer, String> responseBody= enqueueDequeueTxEventQ.pubSubTxEventQ();

if (responseBody != null) {
response.put("ResponseCode", "200");
response.put("ResponseText", "TEQ PubSub execution SUCCESS ...!!!");
response.put("ResponseText", "TxEventQ PubSub execution SUCCESS ...!!!");
response.put("ResponseBody", responseBody);

} else {
response.put("ResponseCode", "300");
response.put("ResponseText", "TEQ PubSub execution FAILED ...!!!");
response.put("ResponseText", "TxEventQ PubSub execution FAILED ...!!!");
}
System.out.println("TEQ PubSub response:" + response);
System.out.println("TxEventQ PubSub response:" + response);
return response;
}

Expand All @@ -103,19 +103,19 @@ public Map<String, Object> workflowAQ() throws Exception {
return response;
}

@GetMapping(value = "/workflowTEQ")
public Map<String, Object> workflowTEQ() throws Exception {
@GetMapping(value = "/workflowTxEventQ")
public Map<String, Object> workflowTxEventQ() throws Exception {
Map<String, Object> response = new HashMap();
Map<Integer, String> responseBody= workflowTEQ.pubSubWorkflowTEQ();
Map<Integer, String> responseBody= workflowTxEventQ.pubSubWorkflowTxEventQ();

if (responseBody != null) {
response.put("ResponseCode", "200");
response.put("ResponseText", "TEQ Enqueue and Dequeue execution SUCCESS ...!!!");
response.put("ResponseText", "TxEventQ Enqueue and Dequeue execution SUCCESS ...!!!");
response.put("ResponseBody", responseBody);

} else {
response.put("ResponseCode", "300");
response.put("ResponseText", "TEQ Enqueue and Dequeue execution FAILED ...!!!");
response.put("ResponseText", "TxEventQ Enqueue and Dequeue execution FAILED ...!!!");
}
System.out.println("AQ Enqueue and Dequeue response:" + response);
return response;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.examples.enqueueDequeueTEQ;
package com.examples.enqueueDequeueTxEventQ;

import java.sql.SQLException;
import java.util.HashMap;
Expand All @@ -18,7 +18,7 @@


@Service
public class EnqueueDequeueTEQ {
public class EnqueueDequeueTxEventQ {

@Autowired(required=true)
private pubSubUtil pubSubUtil;
Expand All @@ -29,13 +29,13 @@ public class EnqueueDequeueTEQ {
@Autowired(required = true)
private ConstantName constantName;

public Map<Integer,String> pubSubTEQ() throws JsonProcessingException, ClassNotFoundException, SQLException, JMSException {
public Map<Integer,String> pubSubTxEventQ() throws JsonProcessingException, ClassNotFoundException, SQLException, JMSException {
Map<Integer,String> response = new HashMap();

TopicSession session = configData.topicDataSourceConnection();
response.put(1, "Topic Connection created.");

pubSubUtil.pubSub(session, constantName.teq_pubSubSubscriber1, constantName.teq_pubSubQueue, "Sample text message");
pubSubUtil.pubSub(session, constantName.txEventQ_pubSubSubscriber1, constantName.txEventQ_pubSubQueue, "Sample text message");
response.put(2, "Topic pubSub executed.");

return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class pubSubUtil {

ObjectMapper mapper = new ObjectMapper();

public UserDetails pubSubWorkflowTEQ(TopicSession session, String subscriberName, String queueName, UserDetails user)
public UserDetails pubSubWorkflowTxEventQ(TopicSession session, String subscriberName, String queueName, UserDetails user)
throws JsonProcessingException, ClassNotFoundException, SQLException, JMSException {

Topic topic = ((AQjmsSession) session).getTopic(username, queueName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.examples.workflowTEQ;
package com.examples.workflowTxEventQ;

import java.sql.SQLException;
import java.util.HashMap;
Expand Down Expand Up @@ -33,7 +33,7 @@
import oracle.ucp.jdbc.PoolDataSourceFactory;

@Service
public class WorkflowTEQ {
public class WorkflowTxEventQ {

@Autowired
UserDetailsDao userDetailsDao;
Expand All @@ -59,7 +59,7 @@ public class WorkflowTEQ {
UserDetails applicationToUser_message;
UserDetails applicationToDeliverer_message;

public Map<Integer,String> pubSubWorkflowTEQ() throws JMSException, SQLException, ClassNotFoundException, JsonMappingException, JsonProcessingException, AQException {
public Map<Integer,String> pubSubWorkflowTxEventQ() throws JMSException, SQLException, ClassNotFoundException, JsonMappingException, JsonProcessingException, AQException {

String deliveryStatus;
Map<Integer,String> response = new HashMap();
Expand All @@ -68,13 +68,13 @@ public Map<Integer,String> pubSubWorkflowTEQ() throws JMSException, SQLException
response.put(1, "Topic Connection created.");

/* 1: USER PLACED OREDER ON APPLICATION */
userToApplication_message = pubSubUtil.pubSubWorkflowTEQ(session, constantName.teq_userApplicationSubscriber, constantName.teq_userQueueName,new UserDetails(rnd.nextInt(99999), "DBUSER", 0, "Pending", "US"));
userToApplication_message = pubSubUtil.pubSubWorkflowTxEventQ(session, constantName.txEventQ_userApplicationSubscriber, constantName.txEventQ_userQueueName,new UserDetails(rnd.nextInt(99999), "DBUSER", 0, "Pending", "US"));
response.put(2,"USER ORDER MESSAGE - ORDERID: " + userToApplication_message.getOrderId() + ", OTP: "
+ userToApplication_message.getOtp() + ", DeliveryStatus: "
+ userToApplication_message.getDeliveryStatus());

/* 2: APPLICATION SHARES OTP TO USER */
applicationToUser_message = pubSubUtil.pubSubWorkflowTEQ(session, constantName.teq_applicationUserSubscriber, constantName.teq_applicationQueueName,
applicationToUser_message = pubSubUtil.pubSubWorkflowTxEventQ(session, constantName.txEventQ_applicationUserSubscriber, constantName.txEventQ_applicationQueueName,
new UserDetails(userToApplication_message.getOrderId(), userToApplication_message.getUsername(),
rnd.nextInt(9999), userToApplication_message.getDeliveryStatus(),
userToApplication_message.getDeliveryLocation()));
Expand All @@ -88,22 +88,22 @@ public Map<Integer,String> pubSubWorkflowTEQ() throws JMSException, SQLException
response.put(4,"APPLICATION ADDED USER ORDER INTO RECORD");

/* 4: APPLICATION SHARES DELIVERY DETAILS TO DELIVERER */
applicationToDeliverer_message = pubSubUtil.pubSubWorkflowTEQ(session, constantName.teq_applicationDelivererSubscriber, constantName.teq_applicationQueueName,
applicationToDeliverer_message = pubSubUtil.pubSubWorkflowTxEventQ(session, constantName.txEventQ_applicationDelivererSubscriber, constantName.txEventQ_applicationQueueName,
new UserDetails(userToApplication_message.getOrderId(), userToApplication_message.getUsername(), 0,
userToApplication_message.getDeliveryStatus(),
userToApplication_message.getDeliveryLocation()));
response.put(5,"APPLICATION TO DELIVERER MESSAGE- ORDERID: "+ applicationToDeliverer_message.getOrderId() + ", OTP: " + applicationToDeliverer_message.getOtp()+ ", DeliveryStatus: " + applicationToDeliverer_message.getDeliveryStatus());

/* 5: USER SHARES OTP TO DELIVERER */
userToDeliverer_message = pubSubUtil.pubSubWorkflowTEQ(session, constantName.teq_userDelivererSubscriber, constantName.teq_userQueueName,
userToDeliverer_message = pubSubUtil.pubSubWorkflowTxEventQ(session, constantName.txEventQ_userDelivererSubscriber, constantName.txEventQ_userQueueName,
new UserDetails(applicationToUser_message.getOrderId(), applicationToUser_message.getUsername(),
applicationToUser_message.getOtp(), applicationToUser_message.getDeliveryStatus(),
applicationToUser_message.getDeliveryLocation()));
response.put(6, "USER TO DELIVERER MESSAGE - ORDERID: " + userToDeliverer_message.getOrderId()+ ", OTP: " + userToDeliverer_message.getOtp() + ", DeliveryStatus: "+ userToDeliverer_message.getDeliveryStatus());
System.out.println();

/* 6: DELIVERER TO APPLICATION FOR OTP VERIFICATION */
delivererToApplication_message = pubSubUtil.pubSubWorkflowTEQ(session, constantName.teq_delivererApplicationSubscriber, constantName.teq_delivererQueueName,
delivererToApplication_message = pubSubUtil.pubSubWorkflowTxEventQ(session, constantName.txEventQ_delivererApplicationSubscriber, constantName.txEventQ_delivererQueueName,
new UserDetails(userToDeliverer_message.getOrderId(), userToDeliverer_message.getUsername(),
userToDeliverer_message.getOtp(), userToDeliverer_message.getDeliveryStatus(),
userToDeliverer_message.getDeliveryLocation()));
Expand All @@ -128,12 +128,12 @@ public Map<Integer,String> pubSubWorkflowTEQ() throws JMSException, SQLException

UserDetails updatedData = userDetailsDao.getUserDetails(delivererToApplication_message.getOrderId());
/* 8: APPLICATION UPDATE DELIVERER TO DELIVER ORDER */
applicationToDeliverer_message = pubSubUtil.pubSubWorkflowTEQ(session, constantName.teq_applicationDelivererSubscriber, constantName.teq_applicationQueueName,
applicationToDeliverer_message = pubSubUtil.pubSubWorkflowTxEventQ(session, constantName.txEventQ_applicationDelivererSubscriber, constantName.txEventQ_applicationQueueName,
new UserDetails(delivererToApplication_message.getOrderId(), delivererToApplication_message.getUsername(), delivererToApplication_message.getOtp(), updatedData.getDeliveryStatus(), delivererToApplication_message.getDeliveryLocation()));
response.put(9, "UPDATE DELIVERER MESSAGE - ORDERID: " + applicationToDeliverer_message.getOrderId()+ ", OTP: " + applicationToDeliverer_message.getOtp() + ", DeliveryStatus: "+ applicationToDeliverer_message.getDeliveryStatus());

/* 9: APPLICATION UPDATE USER FOR DELIVERED ORDER */
applicationToUser_message = pubSubUtil.pubSubWorkflowTEQ(session, constantName.teq_applicationUserSubscriber, constantName.teq_applicationQueueName,
applicationToUser_message = pubSubUtil.pubSubWorkflowTxEventQ(session, constantName.txEventQ_applicationUserSubscriber, constantName.txEventQ_applicationQueueName,
new UserDetails(delivererToApplication_message.getOrderId(), delivererToApplication_message.getUsername(), delivererToApplication_message.getOtp(), updatedData.getDeliveryStatus(), delivererToApplication_message.getDeliveryLocation()));
response.put(10, "UPDATE USER MESSAGE - ORDERID: " + applicationToUser_message.getOrderId() + ", OTP: "+ applicationToUser_message.getOtp() + ", DeliveryStatus: "+ applicationToUser_message.getDeliveryStatus());

Expand Down
6 changes: 3 additions & 3 deletions workshops/oracleAQ/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export ORACLEAQ_PYTHON_TxEventQ=${ORACLEAQ_HOME}/qPython/txEventQ
export ORACLEAQ_NODE_AQ=${ORACLEAQ_HOME}/qNode/aq
export ORACLEAQ_NODE_TxEventQ=${ORACLEAQ_HOME}/qNode/txEventQ

export ORACLEAQ_JAVA=${ORACLEAQ_HOME}/aqJava
export ORACLEAQ_JAVA=${ORACLEAQ_HOME}/qJava

export TNS_ADMIN=$ORACLEAQ_HOME/wallet
export USER_DEFINED_WALLET=${TNS_ADMIN}/user_defined_wallet
Expand Down Expand Up @@ -216,11 +216,11 @@ export JDBC_URL=jdbc:oracle:thin:@${DB_ALIAS}?TNS_ADMIN=${TNS_ADMIN_FOR_JAVA}

#Build java code
cd ../
cd aqJava
cd $ORACLEAQ_JAVA
{
mvn clean install -Dmaven.wagon.http.ssl.insecure=true -Dmaven.test.skip=true
cd target
nohup java -jar aqJava-0.0.1-SNAPSHOT.jar &
nohup java -jar qJava-0.0.1-SNAPSHOT.jar &
} &>/dev/null
echo "Java setup completed."

Expand Down