How to write flume custom sink and source in version 1.3.1 - flume

I am trying to write my own sink and source in flume version 1.3.It doesn't have config file flume-site.xml. How could I use this custom sink after I compile my java file?

You need to put jar with your compiled sink somewhere to flume CLASSPATH. In version 1.3.1, simply lib/ should be sufficient. For newer version you will have option to use "plugins.d" directory, checkout FLUME-1735 [1] for more details (fixed in trunk and will be part of 1.4.0).
To configure flume to actually use your sink, use fully qualified name of your class (e.g. package.ClassName) in the configuration. For example if your class is in package "earth.europe" and the class name is "WorldSink", then you need to use following configuration fragment:
a1.sinks = s1
a1.sinks.s1.type = earth.europe.WorldSink
Jarcec
Links:
1: https://issues.apache.org/jira/browse/FLUME-1735

Related

Neo4J 4 + Apoc : Unable to set up injection for procedure 'Static'

Getting the following error on neo4j server startup with the apoc plugin.
Have copied the jar to the plugins folder.
Caused by:
org.neo4j.kernel.api.exceptions.ComponentInjectionException: Unable to
set up injection for procedure 'Static', the field 'apocConfig' has
type 'class apoc.ApocConfig' which is not a known injectable component
Neo4j version: 4.0.4
Apoc version: 4.0.0.13
What could be the problem?
I would suggest reviewing the installation procedure to see if you missed any steps,
https://neo4j.com/docs/operations-manual/current/installation/linux/
Also, double check the java version that neo4j is using, and check if there are any other local java environment factors specific to this install. class paths, other jars, etc.
We were having the same issue with neo4j 4.x and custom plugin folder.
Updating custom plugin folder in neo4j config didn't work, we had to add folder (or extension) into java CP (classpath) as well.
It worked in 3.x neo4j version without adding a folder into the classpath.
Try to make sure that you have plugins folder listed in -cp and might work for you.
Similar to Ilija's problem, our embedded database (using Eclipse with the Maven plugin) did not like our custom plugin folder.
Since the database was for setup and then deployment (effectively 2 separate things), we could move the database from the default Neo4j directory after it was setup.
As a test, you could delete the contents of your plugin folder and see if it works then.

Grails standalone JAR as linux service configure memory parameters

I have a Grails application that I run as a Linux service. Basically I create a symlink from /etc/init.d/mygrailsservice to mygrailsservice.jar.
I want to increase the amount of OS memory allocated to the service.
How do I configure this?
Have a look at the spring-boot docs for executable jars and using them as system services - https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html
Specifically https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html#deployment-script-customization-when-it-runs
With the exception of JARFILE and APP_NAME, the above settings can be
configured using a .conf file. The file is expected next to the jar
file and have the same name but suffixed with .conf rather than .jar.
For example, a jar named /var/myapp/myapp.jar will use the
configuration file named /var/myapp/myapp.conf.
myapp.conf.
JAVA_OPTS=-Xmx1024M
LOG_FOLDER=/custom/log/folder

Is there a way to convert thrift IDL into wsdl spec?

Is there any open source library or online service that could automagicaly generate wsdl spec on the base of the thrift IDL?
The goal is to build facade API on the top of existing thrift API that would allow coupling with ansient systems via SOAP protocol.
There are a couple of ready to use tools that allow to convert Thrift IDL into WSDL. The rest of the answer assumes we live in the Java world with JDK and Maven at hand and internet connection available.
The first one is Swift Code Generator Tool. As it's readme states, one have to:
download the latest version:
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DremoteRepositories=central::default::http://repo1.maven.apache.org/maven2 -Dartifact=com.facebook.swift:swift-generator-cli:RELEASE:jar:standalone -Ddest=/tmp/
run downloaded jar in the directory containing thrift files:
java -jar /tmp/swift-generator-cli-0.23.1-standalone.jar -use_java_namespace -out ../java *.thrift
assuming standard
- src
- main
- java
- thrift
Maven project layout. Swift Code Generator will generate a Java interface for each Thrift service entry. Every Thrift source file must declare a 'java' namespace, like this:
namespace java com.acme
The generated interface will include nested Async interface for asynchronous invocation. Remove Async subinterface. Automation of Async removal is left as an exercise for the reader.
Compile generated java files with javac or your favourite build tool (ant, maven, gradle, etc.). Do not forget to include com.facebook.swift:swift-annotations:0.23.1 as a compile dependency.
Finally use Apache Axis2' java2wsdl utility available within Axis2 binary distribution, like this:
/tmp/axis2-1.7.4/bin/java2wsdl.sh -cn com.acme.TargetService -cp build/classes/main
to generate wsdl for the Thrift service TargetService {...} entry.

Ant: How to obtain Java path without invoking path from Main?

I'm doing plugin development but none of classes will have a main. So without hard coding a path to my java directory how do i go about doing this?
I currently do this hack job
<property name="jdk.home.1.6" value="C:/Program Files/Java/jdk1.6.0_22"/>
and build upon that.
You have built-in properties in ant: http://www.roseindia.net/tutorials/ant/findHomePath.shtml
That mean you can use:
<property name="jdk.home.1.6" value="${java.home}"/>
HIH
You could try using System.properties()
System.properties() will return information regarding the current java virtual machine configuration.
"file.separator" Character that separates components of a file path. This is "/" on UNIX and "\" on Windows.
"java.class.path" Path used to find directories and JAR archives containing class files. Elements of the class path are separated by a platform-specific character specified in the path.separator property.
"java.home" Installation directory for Java Runtime Environment (JRE)
"java.vendor" JRE vendor name
"java.vendor.url" JRE vendor URL
"java.version" JRE version number
"line.separator" Sequence used by operating system to separate lines in text files
"os.arch" Operating system architecture
"os.name" Operating system name
"os.version" Operating system version
"path.separator" Path separator character used in java.class.path
"user.dir" User working directory
"user.home" User home directory
"user.name" User account name

How to create plugin in neo4j?

I created plugin in neo4j by next steps:
1) create *.class from *.java (copile with Eclipse)
2) put *.class into .../org/neo4j/server/plugins/
3) create *.jar (using jar)
4) put into *.jar/META-INF/services/ file "org.neo4j.server.plugins.ServerPlugin" with text "org.neo4j.server.plugins.TransportRouter".
5) put *.jar into .../neo4j/plugins/
6) restart server
But my plugin do not see in "extensions" ("curl localhost:7474/db/data/").
Why?
TIA, Eugeny.
Adding this answer for the benefit of others. I had similar problem but it was not a issue with the code. You need to make sure neo4j server is stopped before you copy the jar in plugins directory. If you copy it before its stopped then restart it. It will not work. I tried this on both 1.8.2 and 1.9.2
Simple steps to be added for installing plugin
Stop the neo4j server
Copy the plugin jar file in plugins directory.
start the neo4j server
Your plugin should be detected. This issue was reproducible with the example plugin GetAll as well. Hope this helps others.
Eugeny can you list the content of the jar jar tf your-jar.jar and the source code of your class.
Do you depend on any other libraries?
please see the Neo4j manual for the needed steps.
Problem was solved.
It's my error in initialization of my class:
public TransportRouter( EmbeddedReadOnlyGraphDatabase graphdb ) {
It was replaced by:
public TransportRouter() {

Resources