Tags

, , , , ,

In the previous post we learn to Creating and Configuring a JMS queue, in this post we will learn to create a message and publishes it in our queue created earlier.

See the links below to check the other parts:

I’m using Version: 3.6.2 as follows:

Imagem Blog UansCarvalho

Let’s create our XSD to have the input parameters for our message, so that download the XSD DadosDepartamento.xsd

Keep the following in mind: Make an XSD as generic as possible so that we can avoid the high coupling.

This XSD also use it to receive such data in line for we record in our database.

And the place within the XSD folder of your OSB as follows:

Imagem Blog UansCarvalho

Now download our WSDL that will be responsible for creating our Proxy: BlogJmsPublishQueue.wsdl

And the place within the WSDL of your OSB folder as follows:

Imagem Blog UansCarvalho

Note: Above beware if your WSDL and XSD are in the same folder hierarchy and if your project is with the same name as my (OSBProject) so there is no problem in <xs:include as the up arrow, if different check to hit the road.

We will now create our Business Service:

Click on the folder Business

Imagem Blog UansCarvalho

Now click the menu and select File >> New >> Business Service and File Name: Place BlogJmsPublishQueueBusiness.biz and click Finish

Imagem Blog UansCarvalho

In the screen below select the Messaging Service option in the General tab as follows:

Imagem Blog UansCarvalho

Now click on the Messaging tab, and click XML, and then click Browse, then choose the option dadosDepartamentoRequest (element) as shown below and click OK.

Imagem Blog UansCarvalho

So should look like this:

Imagem Blog UansCarvalho

Now click the Transport tab, and then choose Protocol jms and Endpoint URI fill in:

jms://localhost:9000/ConnectionFactoryBlog/BlogQueue

Entenda:

  • localhost:9000 = Address of my Domain OSB
  • ConnectionFactoryBlog = Name of my ConnectionFactory
  • BlogQueue = Name I gave to my Queue

Then click Add and be as follows:

Imagem Blog UansCarvalho

Now click on the JMS Transport tab and select Text Message Type (in this case the message is sent in plain text)

Imagem Blog UansCarvalho

There, we have created our Business, we now create our Proxy which will make this call Business.

Click on the Proxy folder

Imagem Blog UansCarvalho

Now click the menu and select File >> New >> Proxy Service (careful, it’s not Proxy Server because there the two options) and File Name: Place BlogJmsPublishQueueProxy and click Finish

Imagem Blog UansCarvalho

In the General tab click WSDL Web Service and later in Browse, then click BlogJmsPublishQueuePublisherServiceSoapBinding (binding) and click OK

Imagem Blog UansCarvalho

Then we will have the following screen:

Imagem Blog UansCarvalho

Click the Transport tab, and then put EndPoint URI /BlogJmsPublishQueueProxy

Imagem Blog UansCarvalho

Now click the Message Flow tab and drag a Pipeline Pair so that it is as follows:

Imagem Blog UansCarvalho

Within the PipelinePairNode1 and below the Request Pipeline drag a Stage and into the Stage drag a Publish as follows:

Imagem Blog UansCarvalho

Click Publish and below in the Publish Properties tab, click Browse and select the Business we created BlogJmsPublishQueueBusiness.biz and then click OK to we select this Business

Imagem Blog UansCarvalho

Into the now a Replace drag Publish

Imagem Blog UansCarvalho

Click on the Replace box and below Properties do the following:

Click on:

  • Replace node contents so that we can do the replace the content of our body
  • In XPath click <XPath> and the box that open place just one point. as below:
  • In In Variable: put the word body

See below for now looks like this:

Imagem Blog UansCarvalho

Now click <Expression> and the box that opens on your right in the Variable Structures tab put content below which will be the payload through our queue.

<br:dadosDepartamentoRequest xmlns:br=”br.com.uansblog.BlogJmsPublishQueuePublisher”>
<br:numeroDepartamento>{data($body/br:dadosDepartamentoRequest/br:numeroDepartamento)}</br:numeroDepartamento>
<br:nomeDepartamento>{data($body/br:dadosDepartamentoRequest/br:nomeDepartamento)}</br:nomeDepartamento>
<br:localDepartamento>{data($body/br:dadosDepartamentoRequest/br:localDepartamento)}</br:localDepartamento>
</br:dadosDepartamentoRequest>

Note: To get the payload you can call in your SBConsole Business (BlogJmsPublishQueueBusiness.biz) set up and get the contents of the Request and within the payload you will put the data to be received from your Body (for example: $body/br:dadosDepartamentoRequest/br:numeroDepartamento)

Imagem Blog UansCarvalho

It looks like this:

Imagem Blog UansCarvalho

Now in its Response Pipeline drag another Stage and into the Stage drag a Replace so that it is as below:

Imagem Blog UansCarvalho

Click on this new Replace the Properties tab and edit it in Expression be as follows for that drag the RESPONSE operation and put a /* at the end and then click OK

Imagem Blog UansCarvalho

Click again on this Replace box and below Properties do the following:

Click on:

  • Replace node contents so that we can do the replace the content of our body
  • In XPath click <XPath> and the box that open place just one point. as below:
  • In In Variable: coloque a palavra body

Imagem Blog UansCarvalho

Ready, we have made our process for sending the message, now we send the message via Web console.

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 Run and see below how should appear:

Imagem Blog UansCarvalho

There, our Homage was sent

We will now follow where stop our message:

In your browser go to 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 Current and in this case is not yet showing up if their is 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

See you in Messages Current will be the message we send and Messages Total the amount of messages that we send

To view the contents of the message click next to BlogModule! BlogQueue and Show Messages

Imagem Blog UansCarvalho

Now click next to the ID:, that will be a link to display the message:

Imagem Blog UansCarvalho

Imagem Blog UansCarvalho

Okay, here in this post we saw how to create and send a message to our queue, the next post we will see how are we going to eat this message and write it to our database.

 

Hugs and until the Next

/:-D