Broken out into two routes…

 

  1. Consume web service and enqueuer in ActiveMQ
  2. Dequeue from ActiveMQ and persist in PO object in Oracle database

 

 

<route id=”get-po”>

<from uri=”timer://simpleTimer?period=30s”/>

<to uri=”http://cmhlcarchapp01:8080/tradestone/send_po.jsp“/>

<to uri=”jms:queue:testMQ” />

</route>

 

<route id=”insert-db”>

<from uri=”jms:queue:testMQ” />

<convertBodyTo type=”java.lang.String”/>

<setHeader headerName=”po_id”>

<xpath resultType=”java.lang.String”>//po_id/text()</xpath>

</setHeader>

<setHeader headerName=”vendor_id”>

<xpath resultType=”java.lang.String”>//vendor_id/text()</xpath>

</setHeader>

<setHeader headerName=”quantity”>

<xpath resultType=”java.lang.String”>//quantity/text()</xpath>

</setHeader>

<setHeader headerName=”price_per”>

<xpath resultType=”java.lang.String”>//price_per/text()</xpath>

</setHeader>

<to uri=”log:insertLog?showHeaders=true” />

<to uri=”ts:declare l_po po := po(null,1,1,1); l number; begin l := l_po.create_po(:#vendor_id,:#quantity,:#price_per); end;”/>

</route>

 

 

 

 

From: Howard, Steve
Sent: Wednesday, December 21, 2016 12:18 PM
To: Mehta, Kushal <[email protected]>
Subject: RE: Full code

 

Thinking of other things before I forget.  Tradestone mentioned their web service GET is destructive (they didn’t use that term, but that is what it is).  I think they actually flag a message as being picked up, which breaks most standards for idempotence.

 

Regardless, to handle conditions where a system fails after we pick it up from TS but before we persist it (RMS, ESB, etc.),we  need to either:

 

  • Handle with XA/two phase commit so all or none work
  • Have our code be able to handle duplicates on PO’s

 

 

From: Howard, Steve
Sent: Wednesday, December 21, 2016 11:53 AM
To: Mehta, Kushal <[email protected]>
Subject: RE: Full code

 

This route works, although it simply consumes hardcoded XML in a JSP.  It doesn’t enqueue it in the ESB, Camel just routes it.  However, it would be trivial to do that.

 

 

<route id=”insert-db”>

<from uri=”timer://simpleTimer?period=30000″/>

<to uri=”http://cmhlcarchapp01:8080/tradestone/send_po.jsp“/>

<convertBodyTo type=”java.lang.String”/>

<setHeader headerName=”po_id”>

<xpath resultType=”java.lang.String”>//po_id/text()</xpath>

</setHeader>

<setHeader headerName=”vendor_id”>

<xpath resultType=”java.lang.String”>//vendor_id/text()</xpath>

</setHeader>

<setHeader headerName=”quantity”>

<xpath resultType=”java.lang.String”>//quantity/text()</xpath>

</setHeader>

<setHeader headerName=”price_per”>

<xpath resultType=”java.lang.String”>//price_per/text()</xpath>

</setHeader>

<to uri=”log:insertLog?showHeaders=true” /> <!—debug headersà

<to uri=”ts:declare l_po po := po(null,1,1,1); l number; begin l := l_po.create_po(:#vendor_id,:#quantity,:#price_per); end;”/>

</route>

 

 

 

 

From: Mehta, Kushal
Sent: Tuesday, December 20, 2016 4:49 PM
To: Howard, Steve <[email protected]>
Subject: Re: Full code

 

We are going to anyway have a package to build RIB object and to incorporate any additional business logic (which will be called by Camel route) on RMS side. With that package in between ESB and RMA will insulate our integration from any Oracle changes in core package.

 

Just my thought.

 

Thanks,

Kushal Mehta

 

 

Get Outlook for iOS

 

From: Howard, Steve
Sent: Tuesday, December 20, 2016 4:33:20 PM
To: Mehta, Kushal
Subject: Full code

 

It occurred to me that we may want to go through the ODR(?) API your Gap compadre mentioned.  By doing this, we insulate ourselves from changes in the PLSQL object interface that Oracle may make going forward.

 

 

SQL> desc purchase_order

Name                                      Null?    Type

—————————————– ——– —————————-

PO_ID                                              NUMBER

VENDOR_ID                                          NUMBER

QUANTITY                                           NUMBER

PRICE_PER                                          NUMBER

 

SQL> create or replace type po as object (po_id number,

2                                       vendor_id number,

3                                       quantity number,

4                                       price_per number,

5                                       member function create_po(p_vendor_id in number,

6                                                                 p_quantity in number,

7                                                                 p_price_per in number)

8                                         return number)

9  /

 

Type created.

 

SQL> create or replace type body po as

2    member function create_po(p_vendor_id in number, p_quantity in number, p_price_per in number) return number is

3      l_po_id number;

4    begin

5      select po_seq.nextval into l_po_id from dual;

6      insert into purchase_order values(l_po_id,p_vendor_id,p_quantity,p_price_per);

7      commit;

8      return l_po_id;

9    end create_po;

10  end;

11  /

 

Type body created.

 

SQL> declare

2    l_po po := po(null,1,1,1);

3  begin

4    dbms_output.put_line(l_po.create_po(100,100,100));

5  end;

6  /

 

PL/SQL procedure successfully completed.

 

SQL> select * from purchase_order;

 

PO_ID  VENDOR_ID   QUANTITY  PRICE_PER

———- ———- ———- ———-

1        100        100        100

 

SQL>

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.