||
Skip to end of metadata
Go to start of metadata

The File event publisher writes the output events in XML, text, and JSON formats in the file.

Creating a file output event publisher

For instructions to create a Java Nio based file output event publisher, see Configuring Event Publishers.

Configuring publisher properties

A File output event publisher can be configured in the Management Console as shown below.

The properties configured above are described in the table below.

Adapter property
Description
Configuration file property
Example

File Name

The absolute path of the file to write the data.

filename
/Users/User/Desktop/abc.txt
Buffer SizeThe buffer size allocated for each event.
buffersize
1024

After entering the above publisher properties, click Advanced and do the following.

  • Select the event stream to which you want to map the incoming events.
  • Select the message format in which the events should be received.
  • Define custom output mappings based on the message format you selected.

For more information, see Output Mapping Types.

You can also configure the properties mentioned above based on the transport type within the <from> element of the event publisher configuration in the <PRODUCT_HOME>/repository/deployment/server/eventpublishers/ directory as shown below.

<?xml version="1.0" encoding="UTF-8"?>
<eventPublisher name="file" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
 <from streamName="Stock" version="1.0.0"/>
 <mapping customMapping="disable" type="json"/>
 <to eventAdapterType="file">
 <property name="buffersize">1024</property>
 <property name="filename">/home/rajjaz/Documents/CEP/wso2cep-4.1.0/samples/artifacts/file/fileWriter.txt</property>
 </to>
</eventPublisher>

 

2797
2798
2799
3125
1012
1027
1648
2041
1826
1830
1915
1978
  • No labels