Formatting archive file names in JCA File adapter - soa

When we select the "archive file" option in the File adapter configuration wizard,
the archive that is created has the name something like "filename_token_timestamp" or "filename_timestamp".
How can I format this file name so that the archived file name is the same as the original filename.
Current format : "filename_timestamp"
Required format : "filename"

Please try this:
A-Configure the File Adapter normally, specify the file name pattern at design time.
B-In the Invoke activity (BPEL process), as you wire it to a File Adapter partner link, you get the Edit Invoke dialogue.
C-Go to properties and configure "jca.file.FileName" with value set to a variable that will be populated at runtime in some assign activity before the invoke activity. This overrides the name mentioned at the design time.

Related

how to read vars.<varName> in properties component - 'file' field in mule 4

My property file name is dev_123.yaml.
dev is an environment variable called env.
123 is a value coming from query param called rollId. Am storing this value in vars.rollId.
In configuration properties component, under 'file' field it will work if I give ${env}_123.yaml.
However, I want to read the value of '123' dynamically via vars too. I tried the following but dint work:
#[p('env') ++ "_" ++ vars.rollId ++ ".yaml"]
${env}_${vars.rollId}.yaml
That will not work. Configuration properties and configuration files are resolved at the startup of a Mule application. Variables are defined during flow execution, after application startup. There is no way to set a variable during start-up. Using configuration properties in the properties file name works because they are resolved at the same time.
An alternative could be to create a custom Mule Module with Mule SDK that implements operations to read properties files dynamically during flow execution. You have to consider if it worth the effort.

BizTalk pipeline custom component disassemble with no document schema

I am going to parse and format the flat file input based on the business logic stored in SQL server database tables. I don’t have a document schema for the input. I wrote a C# custom component class for the disassemble. When I use the custom component in Disassemble stage in receive pipeline, I am getting document schema not found error.
Did anyone come across with same situation and handled it differently? .
BizTalk routes messages using the 'MessageType' property (The namespace + the root node name of the XML in the message) in the context portion of the message. You don't have that with your design so it doesn't know what to do with it.
You can:
handle each type of flat file separately by parsing and assigning a unique message type
distill the content into one type of message
wrap the content of the file in an 'envelope'
You'll need to create a schema for any of those choices.
Namespaces and routing are a spiffy way to handle changes to file structure. If you include the version of the file in the namespace BizTalk can route the message to the code that handles that kind of message for you. You can continue to handle old style messages as well as new formats. We handle pilot programs that way.

Renaming files using custom pipeline in BizTalk

I tried to rename a file before sending the file to an ftp location using the SFTP adapter in BizTalk 2013. Can you help me on this ?
You need to change the FILE.ReceivedFileName property on the message to your new filename.
If you use an orchestration you can do this in an expression within a message assignment shape as follows:
OutboundMessage(FILE.ReceivedFileName) = "NewFileName.csv"
If you aren't using an orchestration you have to use a custom pipeline component.
The code to do this within the component is as follows, which goes in the pipeline component's Execute method:
pInMsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", "NewFileName.csv");
Finally in the SFTP adapter set the filename to %SourceFileName%
Hope this helps.
I believe the URL for the context is different per adapter.
The one you need is:
SFTP:
http://schemas.microsoft.com/BizTalk/2012/Adapter/sftp-properties
So in your case it would be :
pInMsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2012/Adapter/sftp-properties", "NewFileName.csv");
Thx

Text file output from Biztalk?

I have a mapping in Biztalk from an external XML schema to an internal XML schema. The internal schema I wish to map to a flat file schema. But that doesent seems to be possible. I cant select the flat file schema as destination schema. So I guess I need to use a flat file assembler in a send pipeline? But on properties on the flat file assembler the flat file schema is not visible under Document Schema.
Do you know how to do this?
I use Biztalk 2009
+1 to what Jay said.
Moreover, You should do the following after step 2:
2.1 Create a new Map that references source schema (external schema) and destination schema (flat file schema created in step 2)
and then you should use this map to transform XML to flat file. This should be done using a send port configured with two things:
pipeline (already mentioned in Jay's response, #3)
Outbound Maps, you can find that in BizTalk Administration console under Send Port properties .. You should configure add the map you created in step 2.1 to the outbound maps.
Typically, you should be receiving the XML file on a receive location. so what you need to do is to create a new receive port, and a receive location. and in the send port properties (again!) add a new filter with the following configuration:
BTS.ReceivePortName == XXXXX
Where XXXXX is the receive port name.
This way, any message is received on receipt port XXXXX is going to be sent to the send port with the map and pipeline already configured.
Create an example flat file that has the formatting you want for your output
Create a flat file schema using the flat file schema wizard. Use your example file as the input to the wizard.
create a pipeline. Put the flat file assembler into the pipeline.
Click on the flat file assembler shape and set the document schema to the flat file schema you created. This tells it the format of the output file.
Create a send port and use the pipeline you created.
Send your data to the send port.

Determining the actual file name sent when using Send Port Macros

I have a BizTalk 2009 send port that uses the %datetime_bts2000% macro in the file name. When I look at the tracked message event, I don't get the name of the actual file that was sent. I thought I could get it from the context property:
OutboundTransportLocation
SFTP://xxx#xxxx.xxx.com:22/Inbound/Encrypted/xxx.xxx.xxx.201101280410324
Promoted
http://schemas.microsoft.com/BizTalk/2003/system-properties
It turns out that the date is equivalent to my deployment date... not the actual date time stamp of the sent file.
Where do I find the actual filename generated by the Macro?
I happen to agree with #Bryan. I have in fact created such a pipeline to preserve OR set the attachment file name explicitly in a pipeline that I use for email.

Resources