Parameterize a queue name in a reader

#1

We have a custom type which reads the location of an input measurement streamed file from an AS SQS Queu, as follows
@queue(name=“OriginC3StreamingDataQueue”, doNotUpsertQueue=true)
type WellStreamMeasurementReader mixes QueueInboundMessage {
receiveBatch: ~ js server
}

This worked great as a POC in a predev environment where we could hard-code some7.8-specific features (like the queue name) to get it to work, but for each environment (prod, QA, etc.), we have a different SQS queue (queue names must be globally unique) that is to be used. There will also be multiple types that are streamed and each type will use a different queue, Canonical, destination, transformation, etc.

So as to be able to migrate / provision the code to production without hard-coded queue names, I configured a new value in TenantConfig as follows
TenantConfig.upsert({id:"StreamMeasureQueue",name:"StreamMeasureQueue",value:"OriginC3ProdStreamPiNumQ"};

I then want the value of the TenantConfig.StreamMeasureQueue to populate the queue name in the first code (type declaration).

How do I parameterise this value so the type populates with the value OriginC3ProdStreamPiNumQ into the @queue(name) property?

0 Likes

#2

Per @rohit.sureka, this feature is not currently implemented.

0 Likes

#3

Update: this feature has been refactored, the queue names are part of configuration framework now. The above approach is no longer valid.

0 Likes

#4

@yaroslav Can you provide the new way to subscribe to queues please?

0 Likes

#5

@tony.li which types should they now be looking at?

0 Likes

#6

@NabilKoroghli if you have a type that mixes QueueInboundMessage, it can be configured with a queueName, kind (queue kind), and subscribe (true/false). See documentation for QueueInboundMessage in C3Docs. For example:

FooType mixes QueueInboundMessage
var config = FooType.make().getConfig();
config.queueName =
config.kind = ‘sqs’
config.subscribe = true
config.setConfig()

After this has been done, your new type will start processing inbound SQS messages.

1 Like

#7

@tony.li, I see only kind and queueName properties but not subscribe. We are on c3-server-7.8.1.4366

0 Likes