BPEL,  OSB

Working with JMS Messages on OSB – Part 3: Receiving Message

Post this we get the picture Queue JMS we send as previous post and record it in our DataBase XE.

See the links below to check the other parts:

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.

Imagem Blog UansCarvalho

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

Imagem Blog UansCarvalho

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

Imagem Blog UansCarvalho

The BPEL then looked like this:

Imagem Blog UansCarvalho

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

Imagem Blog UansCarvalho

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.

Imagem Blog UansCarvalho

See our Business is based on WSDL normally.

Imagem Blog UansCarvalho

And are pointing to our BPEL

Imagem Blog UansCarvalho

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

Imagem Blog UansCarvalho

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.

Imagem Blog UansCarvalho

The Transport tab, choose the JMS Protocol option and place in Endpoint URI as follows are the settings you created in Step 1

Imagem Blog UansCarvalho

In JMS Transport tab in Destination Type choose the Queue option

Imagem Blog UansCarvalho

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:

Imagem Blog UansCarvalho

Click on the name and Routing as follows select our Business (RecebeFilaBusiness.biz) and Involking select the option process

Imagem Blog UansCarvalho

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>

Imagem Blog UansCarvalho

Note: This is the request of our payload Business RecebeFilaBusiness.biz

Imagem Blog UansCarvalho

So should look like this:

Imagem Blog UansCarvalho

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:

Imagem Blog UansCarvalho

Click Resource Browser and right should appear to our Proxy BlogJmsPublishQueueProxy

Imagem Blog UansCarvalho

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>

Imagem Blog UansCarvalho

Click Execute and see below how should appear:

Imagem Blog UansCarvalho

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:

Imagem Blog UansCarvalho

In the screenshot below click JMS Modules as follows:

Imagem Blog UansCarvalho

Now click BlogModule

Imagem Blog UansCarvalho

Now click BlogQueue

Imagem Blog UansCarvalho

Now click Monitoring

Imagem Blog UansCarvalho

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.

Imagem Blog UansCarvalho

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

Imagem Blog UansCarvalho

Now we have:

Imagem Blog UansCarvalho

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.

Imagem Blog UansCarvalho

 

Hugs and until the Next

/:-D

 

 

Criei este Blog destinado a desenvolvedores e interessados na Tecnologia Oracle SOA Suite, minha idéia é que no futuro ele sirva de referência para Analistas e Desenvolvedores desde aprendizes a especialistas. Já existem alguns Posts interessantes que abordam um pouco do meu dia a dia, no passar do tempo irei alimentar este Blog com o máximo de informações possíveis, por isso peço por gentileza aos interessados e afins que caso tenham alguma dúvida, sugestão ou crítica que me digam para que eu possa da melhor forma suprir as expectativas e na medida do possível sanar todas as duvidas que vierem a surgir ou até mesmo criar novos Posts abordando algum tópico que venha a ser relevante para todos os interessados. Obrigado Uans Carvalho

Leave a Reply

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