Friday, February 9, 2024

#1006 Rapid Adapter Builder Part 3



Continuing the series of posts on this compelling new feature. The previous posts covered my basic adapter for RabbitMQ. If you remember, the connection creation was as follows -


So all I could decide upon was the security policy to be used.

Naturally we need more - let's look again at the url I used, when testing in Postman - https://crow-01.rmq.cloudamqp.com/api/queues/{{account}}/{{queue}}/get

Note the 2 variables - account and queue. Wouldn't it be useful for the integration developer to be able to enter that data, when she is configuring the invoke?

Also how about giving the connection creator the ability to enter the connection type and relevant base url. This could be, in my case, https://crow-01.rmq.cloudamqp.com/api/queues.
So let's do this.

Firstly, adding the ability to select connection type and base url.
























Note the use of type = CHOICE for the connection type. This will generate a list of options. I then add the 2 options below - REST API Base URI and Open API (1.0/2.0/3.0)

The next property is the connection URL; as you can see, I have added a default value here. This is purely to save me typing it in again and again. You will not do this in real life.
 
The result is as follows - 


btw. coinĂ­n is the Irish for rabbit. 

Next step, we want the person configuring the invoke to be able to specify the account and queue.

I only require this for the GET operation, remember my Rabbit MQ adapter allows me to PUT and GET messages.

So this only applies to the GET - therefore we add these to the configuration section of the GetMessageAction

Note again, I set the defaults, just to save me typing.

Now all we need to do is construct the uri for the GET operation. It will have the following format - 
connectionURL /rabbitMQAccount/ queue/get

I construct it as follows - 
"uri": "${.connectionProperties.connectionURL+ \"/\"+.configuration.rabbitMQAccount+ \"/\"+.configuration.queue+\"/get\"}"

Note the . notation and how I address the connectionURL as part of connectionProperties etc.

I set this here - in the section for the Get Message actions.

Now let's try it out - I delete the older version of the adapter in OIC - 

Remember, you will only be able to delete, if there are no connections defined in OIC, based on the adapter.

I delete the connection in OIC and then click Delete ADD - 


I publish the adapter again and then test in OIC - 


Connection Properties are displayed with their default values.

I will drop the RabbitMQ invoke after the Assign action - 




































Now to the values I need to add - account and queue - 







































I put a message on the queue - 


Then I get the message via OIC - 


I check the Logger action - 




No comments:

Post a Comment