このコンテンツは選択した言語では利用できません。

11.3. Configuring a sender endpoint's interaction with the file system


Overview

Sender endpoints interact with the file system in basic ways. You can configure a number of the aspects of this behavior including:
  • if the endpoint creates the directory where it writes files
  • how the endpoint names temporary files

Directory creation

The default behavior of a sender endpoint is to automatically create the target directory for its files if that directory does not already exist. To configure an endpoint to not create the target directory, you set its autoCreateDirectory attribute to false. If the directory does not exist, the endpoint will do nothing. You will then have to create the directory manually.
Example 11.2, “Sender endpoint that creates its target directory” shows the configuration for a sender endpoint that does not automatically create its target directory.

Example 11.2. Sender endpoint that creates its target directory

<beans xmlns:file="http://servicemix.apache.org/file/1.0"
	       xmlns:foo="http://servicemix.org/demo/">

  <file:sender service="foo:fileSender"
               endpoint="fileSender"
               directory="outbox"
               autoCreateDirectory="false" />
  ...
</beans>
Copy to Clipboard Toggle word wrap

Appending data

By default, sender endpoints overwrite existing files. If a message wants to reuse the name of an existing file, the file on the file system is overwritten. You can configure a sender endpoint to append the message to the existing file by setting the endpoint's append attribute to true.
Example 11.3, “Sender endpoint that appends existing files” shows the configuration for an endpoint that appends messages to a file if it already exists.

Example 11.3. Sender endpoint that appends existing files

<beans xmlns:file="http://servicemix.apache.org/file/1.0"
	       xmlns:foo="http://servicemix.org/demo/">

  <file:sender service="foo:fileSender"
               endpoint="fileSender"
               directory="outbox"
               append="true" />
  ...
</beans>
Copy to Clipboard Toggle word wrap

Temporary file naming

By default, sender endpoints check the message exchange, or the message itself, for the name to use for the file being written. If the endpoint cannot determine a name for the target file, it will use a temporary file name. Table 11.2, “Attributes used to determine a temporary file name” describes the attributes used to generate the temporary file name.
Note
Checking for the name of the file to write is handled by the marshaler. For more information on marshalers see Chapter 12, File Marshalers.
Expand
Table 11.2. Attributes used to determine a temporary file name
NameDescriptionDefault
tempFilePrefix Specifies the prefix used when creating output files.servicemix-
tempFileSuffix Specifies the file extension to use when creating output files..xml
The generated file names will have the form tempFilePrefixXXXXXtempFileSuffix. The five Xs in the middle of the filename will be filled with randomly generated characters. So given the configuration shown in Example 11.4, “Configuring a sender endpoint's temporary file prefix”, a possible temporary filename would be widgets-xy60s.xml.

Example 11.4. Configuring a sender endpoint's temporary file prefix

<beans xmlns:file="http://servicemix.apache.org/file/1.0"
	       xmlns:foo="http://servicemix.org/demo/">

  <file:sender service="foo:fileSender"
               endpoint="fileSender"
               directory="outbox"
               tempFilePrefix="widgets-" />
  ...
</beans>
Copy to Clipboard Toggle word wrap
トップに戻る
Red Hat logoGithubredditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。 最新の更新を見る.

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

Theme

© 2025 Red Hat