Ask Your Question
1

Config parameter in custom destination

asked 2018-08-13 19:53:38 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

I am creating a custom destination in StreamSets and I have to provide more than one configuration parameter through the UI for the component. Is it possible as I have seen ways to pass only one configuration parameter through the StreamSets tutorial https://github.com/streamsets/tutoria...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-08-14 10:32:51 -0500

metadaddy gravatar image

You can have multiple configuration parameters - the configuration UI is generated automatically from the configuration parameters and their annotations, so all you need to do is add more configuration parameters to the 'DTarget' class.

Here's an example from the custom origin tutorial:

@ConfigDef(
    required = true,
    type = ConfigDef.Type.STRING,
    defaultValue = "",
    label = "Git Repository Directory",
    description = "Location of a local Git repository, for example /src/some/dir",
    displayPosition = 10,
    group = "SAMPLE"
)
public String directory;

/** {@inheritDoc} */
@Override
public String getDirectory() {
  return directory;
}

@ConfigDef(
    required = true,
    type = ConfigDef.Type.NUMBER,
    defaultValue = "1000",
    label = "Scan Interval",
    description = "Time between repository scans (in milliseconds)",
    displayPosition = 20,
    group = "SAMPLE"
)
public int scanInterval;

/** {@inheritDoc} */
@Override
public int getScanInterval() {
  return scanInterval;
}
edit flag offensive delete link more

Comments

1

Thank you so much@metadaddy. It worked well.

Arun gravatar imageArun ( 2018-08-14 19:45:29 -0500 )edit

Great - could you upvote my answer, please? Thanks!

metadaddy gravatar imagemetadaddy ( 2018-08-14 20:31:14 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-08-13 19:53:38 -0500

Seen: 21 times

Last updated: Aug 14