Jump to content

Can I parameterize StreamBase adapter properties


Steve Barber

Recommended Posts

  • 1 year later...

Let me ask you about another Input Adapter.

I have a database where I store all thoses JMS QUEUES, and I want to pass to JMS Reader by parameter or other way a variable with the connection properties.

If I had 1000 queues in other enviroment it could be handle on the fly to all those endpoints.

connection-factory-url="tcp://server:7230"

conncetion-factory-class="com.tibco.tibjms.TibjmsQueueConnectionFactory"

connection-factory-name="GenericConnectionFactory"

use-topics="false"

username="admin"

password="pass"

acknowledge-mode="NO_ACKNOWLEDGE"

server_num_retries="32323332323" >

name-map="MyNameMap"

jms-header-map="SampleHeaderMap"

jms-property-map="SamplePropertyMap"

timestamp-format="defaultTimestampFormat"

devery-mode="PERSISTENT"

converter-custom-settings="ArbitraryKey=ArbitraryValue, AnotherKey=AnotherValue"

message-to-tuple-converter="FROMJMSTEXTMESSAGECONVERTER" />

Follow the documentation it could be possible, but I don't realize how to do it.

Best Regards,

Link to comment
Share on other sites

Hi Jefferson,

I'm not certain what exactly you want to parameterize when for the JMS Reader input adapter.

From your other question, I think you are using StreamBase 7.2.something, so I'll work from that assumption. From the configuration file excerpt above, it looks like your JMS provider is TIBCO EMS. From the name of the connection factory, probably it is a version of EMS prior to EMS 8.1 but maybe not. (Feel free to provide details -- more details usually results in a better answer!)

If you want to use a different configuration file for the adapter for different deployment environments, then you can use a module parameter for the name of the configuration file on the adapter instance in your .sbapp and set that parameter from the value of an operator-parameter in the .sbconf.

But I think what you want to do is be able to subscribe to destinations (in this case, queues) whose names your read from a database.

Have you tried setting up your JMS Reader Input Adapter instance to accept dynamic endpoints See http://docs.streambase.com/sb73/topic/com.streambase.sb.ide.help/data/ht...

Link to comment
Share on other sites

Sorry, that posted before I was finished, so I will just continue.

So, as indicated in the Dynamic Endpoints section, you need to do two things in your adapter configuration file:

1) add a create-destinations="true" attribute to your jms-server element

2) add a default-destination element to the destinations element of your jms-server element

So I think your idea is that you want to read your queue names from your database rather than hard-coding them into the JMS adapter configuration file. You didn't say what kind of database but usually people mean a SQL relational database so let's assume that for now -- using a Query read operator against some JDBC Table data construct. You would run those names through a Map operator to create tuples with the same schema as a Control port input schema for the JMS Reader Input adapter -- you will be creating a CreateDestination command for each queue.

Then you feed those control tuples into your JMS Reader Input Adapter's control port, which you must have enabled by checking the "Add Command Input Port" property on the Adapter properties tab of your adapter instance's StreamBase Properties view.

You may have to enable the ability to create dynamic queues in your EMS server configuration in order for this to work. I'm not an EMS expert but I think this means adding the line

create queues >

to your queues.conf or executing a similar command in tibemsadmin.

OK, all that said, I have sometimes been able to get this all to work and sometimes not, and it seems to depend on which JMS provider I'm using and whether it supports dynamic creation of subscriptions. I think in theory there should be no need to create dynamic queues at all -- the queues should all be able to have been pre-created (static queues) and it is only the subscriptions that are dynamic with respect to the StreamBase JMS Reader Input adapter configuration file. But in practice this hasn't always worked the way I expected.

Therefore, if you try all this and have difficulty, it's worth raising an SR with TIBCO product support to work through this systematically, assuming 7.2 is still supported and assuming you have a current maintenance agreement with TIBCO, neither of which I can check on at them moment.

Also, if I've guessed wrong about what it is you want to do, please clarify here and we can try again!

Link to comment
Share on other sites

Hello Steve, thanks, your explanation was very helpful.

Yes, I'm just trying to get all those queues from SQL Database using JDBC component, and pass to JMS Reader,

I sow the CreateDestination, it seems to be my answer to do subscribe dynamic, I just wont realize how Stream Base manager it, that's another thread...:)

Stream base returns me this error bellow when I've try to pass CreateDestination, but I really don't which jar supose to have this class.

NoClassDefFoundError: com/streambase/sb/adapter/common/AdapterUtil

Thanks a lot,

Link to comment
Share on other sites

  • 4 years later...

Here's the original answer to the question, which was migrated to the question on the move from TIBCOmmunity to TIBCO Community:

Answer:

Generally, you use embedded adapters by adding them to a StreamBase EventFlow application (.sbapp), usually by dragging an instance of theadapter to the EventFlow application canvas using StreamBase Studio.

Embedded adapter instances are configured for specific uses by specifying values in the Properties View for that instance.

If you would like to make an adapter's property settable from somewhere else -- that is, not have to hard-code the value into the application itself -- then there are several methods to do this.

The most common is to use a module parameter as the value of the property -- module parameter references look like ${MYPARAM}. Then you may set an operator-parameter in the Server Configuration file (.sbconf), and set the module parameter to the value of the operator parameter.

 

That sounds like it might be a little complicated, doesn't it So here is an example.

The attached param_example.zip file contains a StreamBase Studio project showing how to do this.

 

You can import this project using File > Import > Existing Projects into Workspace > Next > Select Archive File > Browse > ..../parameter_example.zip > Open > Finish.

 

.sbconf files support XML include so if you want to segment your configuration into environment-specific pieces, that's a good way to do it. There's an element that does clever merging, you may want to consider that rather than a straight XInclude.

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...