See the links below to check the other parts:
- Working with JMS messages on OSB – Part 1: Creating and Configuring Queues
- Working with JMS messages on OSB – Part 2: Publishing a Message Queue
- Working with JMS Messages on OSB – Part 3: Receiving Message
The first thing to do is create a simple BPEL to do an Insert or Update, this paso will not detail how BPEL create this because this is not the focus of this post.
For my tests I’m using Oracle Database XE and using the Department table that have the fields (DEPTNO, NAME AND LOCATION), see below that we have some fields.
See just a few simple details of my BPEL process.
When creating the BPEL marked the option Expose as a SOAP service for not have the need to create a WSDL and I called InsereFila
In DBAdapter left marked the Insert or Update option only for cases where we need to perform an Update, but it is your choice only put Insert Only
The BPEL then looked like this:
Below stay tuned in the XSD that was created automatically because the element name=“process” put the numeroDepartamento elements, nomeDepartamento and localDepartamento that will be the data to be entered by our BPEL and received our JMS Queue
See above that was created just a simple BPEL which changed our input to receive the parameters of our Fila
Now we go to our OSB and the first thing to do is expose this service.
But also expose the service is not the focus we skip this part and if you have any doubts as to expose a service check my Post Exposing a Service in Oracle Service Bus (OSB)
Below only the structures, noting that for our Business did not have to change anything to expose.
See our Business is based on WSDL normally.
And are pointing to our BPEL
It will now detail the creation of Proxy will be the most important at this time.
Create a Proxy with RecebeFilaProxyService name and on the General tab select the Messaging Service option
Down the Messaging tab choose the XML option and point to our XSD DadosDepartamento.xsd which is the same XSD we created in the previous step
This is necessary to make sure that send and receive the same payload without subsequent changes.
The Transport tab, choose the JMS Protocol option and place in Endpoint URI as follows are the settings you created in Step 1
In JMS Transport tab in Destination Type choose the Queue option
In the Message Flow tab, drag a Route to below RecebeFilaProxyService within the Route drag a Routing and within the Routing and below the Request Action drag a Replace so that it is as follows:
Click on the name and Routing as follows select our Business (RecebeFilaBusiness.biz) and Involking select the option process
Now click on the Replace tab in the Properties and set as follows:
- XPath: Place a point.
- In Variable: Write the word body
- Replace node contents (choose this option)
- Expression: Place the payload below:
<rec:process xmlns:rec=”http://xmlns.oracle.com/UansBlogApplication/InsereFila/RecebeFilaBPELProcess”>
<rec:numeroDepartamento>{data($body/br:dadosDepartamentoRequest/br:numeroDepartamento)}</rec:numeroDepartamento>
<rec:nomeDepartamento>{data($body/br:dadosDepartamentoRequest/br:nomeDepartamento)}</rec:nomeDepartamento>
<rec:localDepartamento>{data($body/br:dadosDepartamentoRequest/br:localDepartamento)}</rec:localDepartamento>
</rec:process>
Note: This is the request of our payload Business RecebeFilaBusiness.biz
So should look like this:
Ready … Make the project Publish and we will test.
To perform the procedure is now easy, every time you send a message to the queue, it is automatically recorded in the database, I’ll show you an example:
The part below has been performed in Step 2, but if you have not done let’s do it again so that you understand the process, if you have already done and there was a message in your queue, probably this message has already been consumed and recorded in your bank data.
In your browser go to http://localhost:9000/sbconsole
Note: The 9000 port is the number I chose to create my Domain OSB
Login:
Click Resource Browser and right should appear to our Proxy BlogJmsPublishQueueProxy
The right side in the Actions tab, click the icon that looks like a “green roadster“: and proceed as follows:
<br:dadosDepartamentoRequest xmlns:br=”br.com.uansblog.BlogJmsPublishQueuePublisher”>
<br:numeroDepartamento>50</br:numeroDepartamento>
<br:nomeDepartamento>SISTEMAS</br:nomeDepartamento>
<br:localDepartamento>BRASIL</br:localDepartamento>
</br:dadosDepartamentoRequest>
Click Execute and see below how should appear:
There, our message has been sent …
In your browser go to the address http://localhost:9000/console
Note: The 9000 port is the number I chose to create my Domain OSB
Login:
In the screenshot below click JMS Modules as follows:
Now click BlogModule
Now click BlogQueue
Now click Monitoring
In the screenshot below we need a view called Messages Total and this case is still not showing up, if your are can skip this step.
Then click Customize this table as screen above and below as fit for the right column the following items that will be interesting for us analyze now and then click Apply
Now we have:
Note that in Messages Total we will have Total sent messages, in case we have one for only send a message to our Fila.
Note: Here be very attentive to Consumers Total because it shows us that there is some proxy configured to consume this Queue, and depending on your Domain Servers or configuration, we can have 16 or more, but never zero, if zero check your settings again until an amount > 0 of Consumers.
So that you understand our Proxy we just created RecebeFilaProxyService was configured to be “listening” our queue and each message that fall in this queue will be automatically captured by our Proxy.
See below that recorded our message successfully in our database.
Hugs and until the Next
/:-D