title: Flume: Data transferring to Server
body: <p>I am new to Flume-ng. I have to write a program, which can transfer a text file to other program (agent). I know we must know about agent i.e. host-ip, port number etc. Then a source, sink and  a channel should be defined. I just want to transfer a log file to server. My client code is as follows.
  public class MyRpcClientFacade {</p>
  
  <pre><code>public class MyClient{
  
    private RpcClient client;
    private String hostname;
    private int port;
  
    public void init(String hostname, int port) {
          this.hostname = hostname;
          this.port = port;
          this.client = RpcClientFactory.getDefaultInstance(hostname, port);
  
        }
  
        public void sendDataToFlume(String data) {
          Event event = EventBuilder.withBody(data, Charset.forName("UTF-8"));
          try {
            client.append(event);
          } catch (EventDeliveryException e) {
            client.close();
            client = null;
            client = RpcClientFactory.getDefaultInstance(hostname, port);
          }
        }
  
        public void cleanUp() {
          client.close();
        }
  }
  </code></pre>
  
  <p>Above code can send only <code>String</code> data to specified process. But i have to send files. Moreover tell me please that whether <code>Source,Channel and Sink</code> have to be written onto server? And if so, how to configure and write these three. Please help me. Give a small sample of <code>Source,Sink And Channel</code></p>