How to pass parameters in flume - flume-ng

I have a twitter flume source defined like this in the flume configuration file
TwitterAgent.sources.Twitter.type = com.cloudera.flume.source.TwitterSource
TwitterAgent.sources.Twitter.channels = MemChannel
TwitterAgent.sources.Twitter.consumerKey = xxxxx
TwitterAgent.sources.Twitter.consumerSecret = xxx
TwitterAgent.sources.Twitter.accessToken = xxx
TwitterAgent.sources.Twitter.accessTokenSecret = xxx
TwitterAgent.sources.Twitter.keywords = Avengers
The 'keywords' property is hardcoded to 'Avengers'. I wanted to make this property value a variable and pass it in while I start my flume agent. I tried positional parameters but doesn't seem to work.
Any ideas on how to get this done ?

Yes, the proxy feature is missing in twitter-source. I've submitted a patch which is waiting for acceptance. Until then feel free to pull my version from github:
https://github.com/schmiegelow/flume/blob/trunk/flume-ng-sources/flume-twitter-source/src/main/java/org/apache/flume/source/twitter/TwitterSource.java
Cheers,
Erik

Related

How to turn off reasoning in the Grakn python client

I am using the Grakn python client and I want to query for data without reasoning turned on.
client = GraknClient(uri=uri)
session = client.session(keyspace=keyspace)
tx = session.transaction().read()
Do I pass an argument in the transaction() method?
You can turn the reasoning off for every specific query by passing infer=False parameter like this
transaction.execute(query, infer=True, explain=False, batch_size=50);
Check out the documentation http://dev.grakn.ai/docs/client-api/python#lazily-execute-a-graql-query

How do I use dynamic keyword in Kusto

I'm using Azure Resource Graph which is using Kusto language for query Azure resources and confused how I can create my own objects via dynamic keyword from existing ones. Example is below which is showing that I'm trying to just assign the same value to disk to dynamic object osDisk but it fails with InvalidQuery. What am I doing wrong?
where type =~ 'Microsoft.Compute/virtualmachines'
| extend disk = properties.storageProfile.osDisk
| extend osDisk = dynamic({"osdisk" : properties.storageProfile.osDisk})
|project disk, osDisk
Error
Please provide below info when asking for support: timestamp = 2019-07-20T01:55:46.6283092Z, correlationId = 297ad2ed-81f2-49b3-86b2-5f38e2394923. (Code: BadRequest) Query is invalid. Please refer to the documentation for the Azure Resource Graph service and fix the error before retrying. (Code: InvalidQuery)
Removing dynamic line option returns results properly
try using pack(): https://learn.microsoft.com/en-us/azure/kusto/query/packfunction
print disk = "disk_value", properties = dynamic({"storageProfile":{"osDisk":"osDisk_value"}})
| project disk, osDisk = pack("osDisk", properties.storageProfile.osDisk)

Setting TCP_KEEPALIVE_THRESHOLD in Netty on Solaris

As mentioned in documentation below, Solaris supports setting of TCP_KEEPALIVE_THRESHOLD and TCP_KEEPALIVE_ABORT_THRESHOLD per socket:
https://docs.oracle.com/cd/E19120-01/open.solaris/819-2724/fsvdh/index.html
We are using Netty to set SO_KEEPALIVE to true and changing interval in OS:
ndd -set /dev/tcp tcp_keepalive_interval 1440000
Is there any way in Netty to set keepalive wait/abort interval per socket? If not, is there any interface or native method that we can use for this?
From documentation:
Method Option():
Allow to specify a ChannelOption which is used for the Channel
instances once they got created. Use a value of null to remove a
previous set ChannelOption
Another solution I think should work is get the ServerBootstrap object and set the option false using:
...
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.option(ChannelOption.SO_KEEPALIVE, false)
.handler(new LoggingHandler(LogLevel.INFO))
...
It should works in Netty 4 and 5. Hope it helps :)

JClouds not able to get the list of images

I have used the code below:
Iterable<Module> modules = ImmutableSet.<Module> of(
new SshjSshClientModule());
ContextBuilder builder = ContextBuilder.newBuilder(provider).endpoint(endpoint)
.credentials(identity, credential)
.modules(modules);
System.out.printf(">> initializing %s%n", builder.getApiMetadata());
ComputeService compute = builder.buildView(ComputeServiceContext.class).getComputeService();
System.out.println(compute1.listImages());
but I am getting the following error message.........
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY at line 1 column 787
at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:181)
at org.jclouds.json.internal.NullFilteringTypeAdapterFactories$IterableTypeAdapter.readAndBuild(NullFilteringTypeAdapterFactories.java:92)
The code was working... before...
You've definitely hit a bug somewhere between the version of jclouds you're using and whatever version of whatever cloud you're using. We'll need more information to fix this. Please go through the instruction on how to Report a Bug to Apache jclouds.

JAX-WS: define server side handler chain in code and not in external xml

i want to enable http compression for my jax-ws webservice. i found out that i have to do it with a custom handlerchain that can modify the http-headers.
all tutorials i found refer to the annotation #HandlerChain that points to a handler chain configuration xml-file but my problem is that my webservice has to be as lightweight as possible therefore i cant define my handler chain in an external xml file.
i tried the following but did not succeed:
final Endpoint ep = Endpoint.publish("http://localhost:8878/mywebservice",
new WebserviceImpl() );
final Binding binding = ep.getBinding();
final List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(new MySuperbSOAPHandler());
binding.setHandlerChain(handlerChain);
does anyone know how to do this? is it even possible?
It doesn't appear that you can change the handler chain when the service has already been published.
If your actual use case is as above, it's easy to fix by simply create()ing and then publish()ing.
final Endpoint ep = Endpoint.create(new WebserviceImpl() );
final Binding binding = ep.getBinding();
final List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(new MySuperbSOAPHandler());
binding.setHandlerChain(handlerChain);
ep.publish("http://localhost:8878/mywebservice");

Resources