Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
serdarkilic
Contributor
Contributor

Component Kit - Output record

Hi all,

I'm writing a custom component using the Component Toolkit targeting 7.x of TOS. I want to be able to pass through the messageid that its returned from AWS to downstream components (tLogRow in this instance).

 

I have the inputs setup and whilst debugging can see the messageId set (as output to the console via System.out) however I'm unable to see it in the tLogRow. I'm assuming it's something to do with how the record is setup but I'm not getting any errors either.

 

I did initially setup the project using the starter kit and selecting Processor but manually added in the @Output final OutputEmitter defaultOutput code. 

 

@ElementListener
    public void onNext(
            @Input final Record defaultInput,
            @Output final OutputEmitter<Record> defaultOutput){
        System.out.println("xxx["+configuration.getLevel().toUpperCase()+"] "+defaultInput);

        final AmazonSNS snsClient = AmazonSNSClientBuilder.defaultClient();

        String publishMessage = "json_payload_xxxx";

        final String arn = "secret";

        final PublishRequest publishRequest = new PublishRequest(arn, publishMessage);

        publishRequest.setSubject("subj");
        publishRequest.setMessageStructure("json");

        final PublishResult publishResponse = snsClient.publish(publishRequest);

        String messageId = publishResponse.getMessageId();

        Record record = recordBuilderFactory.newRecordBuilder().withString("messageId", messageId).build();


        System.out.println(record.getString("messageId"));
        // Print the MessageId of the message.

        defaultOutput.emit(record);
    }
Labels (2)
1 Reply
Anonymous
Not applicable

Hi @serdarkilic,

Did you ensure all components have a schema set up?
You can need to hit "guess schema" button to do it.