8
File Component In Mule Demo

Mule File component

Embed Size (px)

Citation preview

Page 1: Mule File component

File Component In Mule Demo

Page 2: Mule File component

Abstract

• The main motto of this PPT is how to use File component in our applications.

Page 3: Mule File component

Introduction

• The File connector allows your Mule application to exchange files with a file system. You can implement the File connector as an inbound endpoint (such as, a message source), or as an outbound endpoint. This endpoint implements a one-way exchange pattern only.

Page 4: Mule File component

Example

Page 5: Mule File component

• .mflow• <?xml version="1.0" encoding="UTF-8"?>

• <mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd

• http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd

• http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">

• <flow name="FileFlow1" doc:name="FileFlow1">• <file:inbound-endpoint path=“Source file location" moveToDirectory=“Destination file location"

responseTimeout="10000" doc:name="File"/>• <logger message="--file is successfully picked" level="INFO" doc:name="Logger"/>• </flow>• </mule>

Page 6: Mule File component

• Output:• INFO 2015-09-15 12:32:25,959 [main] org.mule.module.management.agent.JmxAgent: Registered

Connector Service with name Mule.File:type=Connector,name="connector.file.mule.default.1"• INFO 2015-09-15 12:32:25,962 [main] org.mule.DefaultMuleContext: • **********************************************************************• * Application: File *• * OS encoding: Cp1252, Mule encoding: UTF-8 *• * *• * Agents Running: *• * Clustering Agent *• * JMX Agent *• **********************************************************************• INFO 2015-09-15 12:32:25,963 [main] org.mule.module.launcher.MuleDeploymentService: • ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++• + Started app 'File' +• ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++• INFO 2015-09-15 12:32:26,931 [[File].connector.file.mule.default.receiver.01]

org.mule.transport.file.FileMessageReceiver: Lock obtained on file: Source file location\filename.xml• INFO 2015-09-15 12:32:26,990 [[File].FileFlow1.stage1.02]

org.mule.api.processor.LoggerMessageProcessor: --file is successfully picked

Page 7: Mule File component

• Flow of execution:1. Service will pole the file for every 1sec”2. It will pick the file from source folder and will

move to destination location3. Service will display a message called “file is

successfully picked”