How to configure a fte ant script so it can perform few task before file transfer - websphere-mq-fte

can any one please suggest me some good sites so i can learn how to use FTE & FTE ant script. Basically i want to wite ant script to perform few task before file tranfer.

I resolved it .. below is the solution for reference:
<request version="1.00" xsi:noNamespaceSchemaLocation="FileTransfer.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<managedCall>
<originator>
<hostName>X.com</hostName>
<userID>X</userID>
<mqmdUserID>X</mqmdUserID>
</originator>
<agent QMgr="X" agent="X"/>
<reply QMGR="X">reply</reply>
<transferSet priority="1">
<metaDataSet>
<metaData key="com.ibm.wmqfte.SourceAgent">X</metaData>
<metaData key="com.ibm.wmqfte.DestinationAgent">X</metaData>
</metaDataSet>
<call>
<command name="X.xml" type="antscript" retryCount="2" retryWait="30" successRC="0">
<target>X</target>
<property name="trigger.filename" value="${FileName}"/>
</command>
</call>
</transferSet>
<job>
<name>X</name>
</job>
</managedCall>
</request>

WMQ InfoCenter has good information on FTE Ant scripting. You can also look at this developerWorks article.

Related

impossible to publish artifacts for.... java.io.IOException: missing artifact lib#MyService;1.0!MyService.jar

Basically I am exploring IVY, to version my binary artifacts and how to do version control automatically using ivy. I found that publish, pubrevision could help me out.
Hence I am trying to publish my jar through IVY. However I am getting below error and build failed.
impossible to publish artifacts for lib#MyService;working#Localhost java.io.IOException: missing artifact lib#MyService;1.0!MyService.jar
Please find my ivy.xml
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="lib" module="MyService" />
<configurations defaultconfmapping="default->default;sources->sources;test->default">
<conf name="sources" transitive="false" visibility="private" />
<conf name="test" transitive="false" visibility="private" />
<conf name="default" transitive="false" />
</configurations>
<publications>
<artifact name="MyService" type="jar"/>
</publications>
<dependencies defaultconf="default">
<dependency org="lib" name="commons-logging-1.1" rev="1.1" />
<dependency org="lib" name="commons-collections-3.2" rev="3.2" />
<dependency org="lib" name="commons-beanutils" rev="1.7.0" conf="default" />
</dependencies>
</ivy-module>
Publish task : Note: dist will resolve my dependency and compile and jar
build.xml
<target name="publish" depends="dist">
<ivy:publish resolver="local" pubrevision="1.0" module="MyService" status="release" forcedeliver="true" update="true">
<artifacts pattern="publish/[organisation]-[artifact].[ext]"/>
</ivy:publish>
</target>
MyService.jar is being created in my build folder.
Can you please assist me, what is wrong with my code. I am pretty new to IVY. So any inputs will be appreciated very much.
Thanks.

Is it possible that a directory copied and pasted to a particular directory using XHTML plugin in DITA OT 1.8.5

Is it possible that a directory or a file copying from 'resource' folder in org.dita.xhtml to out put folder generated by the XHTML DITA OT transform.
If its possible using xsl changes in plugin its possible means provide me the code.
Any other way is there means please guide me the steps to do.
Please assist me.
You should use the depend.preprocess.post extension point, or another one that fits your needs, to call a new Ant target.
plugin.xml
<plugin id="com.example.extendchunk">
<feature extension="depend.preprocess.post" value="copyfiles"/>
<feature extension="dita.conductor.target.relative" file="myAntStuffWrapper.xml"/>
</plugin>
myAntStuffWrapper.xml
<dummy>
<import file="myAntStuff.xml"/>
</dummy>
myAntStuff.xml
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="myAntStuff">
<target name="copyfiles">
<copy todir="foo">
<fileset>
<include name="**/*.bar"/>
</fileset>
</copy>
</target>
</project>

WSO2 task to run exactly once at startup

I need a task to be run exactly once at the wso2 startup. How do we ensure this.
The following did not work in the scheduled task
<trigger once="true"/>
Try with
<trigger count="1" interval="1"/>
I am using the ESB 4.8.1. For me both configurations are worked fine. Followings are the sample schedule tasks which I have tested in each case.
1.Configuration 1 -<trigger once="true"/>
<?xml version="1.0" encoding="UTF-8"?>
<task xmlns="http://ws.apache.org/ns/synapse" name="MyTask" class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz">
<trigger once="true"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
<name xmlns="">The message will be displayed once</name>
</property>
</task>
2.Configuration -<trigger count="1" interval="1"/>
<?xml version="1.0" encoding="UTF-8"?>
<task xmlns="http://ws.apache.org/ns/synapse" name="MyTask" class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz">
<trigger count="1" interval="1"/>
<property xmlns:task="http://www.wso2.org/products/wso2commons/tasks" name="message">
<name xmlns="">The message will be displayed once</name>
</property>
</task>
However, in the ESB documentation recommended to use <trigger once="true"/> to execute tasks only once after the esb starts.
I also had the same problem (using ESB4.9). After trying lots of options I found a working config to be:
<trigger once="true" count="1" interval="1"/>
There seems to be a bug that is still present in the latest ESB (Integrator v. 6.4.0).
The only way a trigger will launch on startup and/or deployment of CAR archive, is if you set the interval to any number higher than 1000. I set it to 1001 and it ran straight away both on deployment as well as on restart. Example config below:
<?xml version="1.0" encoding="UTF-8"?>
<task class="org.apache.synapse.startup.tasks.MessageInjector" group="synapse.simple.quartz" name="TSK_Logoff" xmlns="http://ws.apache.org/ns/synapse">
<trigger interval="1001" count="1" />
<property name="sequenceName" value="SEQ_Logoff" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="injectTo" value="sequence" xmlns:task="http://www.wso2.org/products/wso2commons/tasks"/>
<property name="message" xmlns:task="http://www.wso2.org/products/wso2commons/tasks">
<logoff/>
</property>
Just for the record, the version that I was using was 4.8.1. I did not solve this issue, instead worked-around it and moved the feature that we had to do an exactly once. I moved that from the WSO2 startup to our web layer and thus saved ourselves the trouble of fighting with various WSO2 version upgrades in the future.
I know that this issue happened in early 2016 and it looks odd for me to answer it in March 2019. But this issue seems to be happening on the newer version of WSO2 as well and fellow architects have been referring/commenting to this post even in Jan 2019. Therefore, it would be appropriate for me to comment on what I finally did.

Is there a way to get build status as a property?

I have a ugly Teamcity build configuration using MSBuild. It executes custom application (test runner), which is using custom messaging to report test results to teamcity.
##teamcity[testStarted name='test1']
##teamcity[testFailed name='test1' message='failure message' details='message and stack trace']
Which show in teamcity in build overview and tests tab.
Teamcity recognizes failed tests and if any test fails, it marks the build as failed:
http://i.stack.imgur.com/Qz9UT.png
Later in the MSBuild target I would like to label cvs based on the test results.
Is there a way to get the build status (if it is failed, hanging, warning) as a property? something like %build.status%? The format does not matter - if its a string or number.
PS: I know that best solution to my problem would be to modify the application to return non-zero exit code if test fail.
TeamCty does not seem to expose this directly, but the status can be acquired using the REST api. Here is an example using curl; but you could also uwe PowserShell's Invoke-RestMethod for instance.
Here's the msbuild script that casues test failure I used for testing:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Test">
<Message Importance="high" Text="##teamcity[testStarted name='test1']" />
<Message Importance="high" Text="##teamcity[testFailed name='test1' message='failure message' details='message and stack trace']" />
</Target>
</Project>
Then the script that gets the current build's status, dumps it to a file, reads the file into an msbuild item and then uses regex to get the status out of it. You just have it to supply the tc_user and tc_password properties (or allow guest access) and change the url to match your server.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="GetBuildStatus">
<Target Name="RunCurl">
<PropertyGroup>
<MyTempFile>curl_out</MyTempFile>
</PropertyGroup>
<Exec Command="curl http://localhost/httpAuth/app/rest/builds/id:$(teamcity_build_id) -basic -u $(tc_user):$(tc_password) > $(MyTempFile)"/>
<ReadLinesFromFile File="$(MyTempFile)">
<Output TaskParameter="Lines" ItemName="CurlOutput"/>
</ReadLinesFromFile>
<Delete Files="$(MyTempFile)"/>
</Target>
<Target Name="GetBuildStatus" DependsOnTargets="RunCurl">
<PropertyGroup>
<CurlOutputFull>#(CurlOutput)</CurlOutputFull>
<BuildStatus>$([System.Text.RegularExpressions.Regex]::Match($(CurlOutputFull), `status="(\w*)"`).Groups[ 1 ].Value)</BuildStatus>
</PropertyGroup>
<Message Text="BuildStatus = $(BuildStatus)"/>
</Target>
</Project>
This prints:
BuildStatus = FAILURE

log4cxx config file syntax

I'm just discovering log4cxx logging framework.
It seems there are two different syntaxes for writing config file:
xml manner
key-value manner
Is there a difference or a best practice in this two approaches?
In log4j, Ceki Gulcu (the author) suggests XML configuration over text file, and it takes precedence in default initialization, too (log4j.xml over log4j.txt). You can achieve slightly more with XML configuration than with the text file (I think you cannot manipulate logger additivity and set log4j debug mode with text file configuration).
That said, log4cxx first looks for log4cxx.xml, too, but there are hardly any examples of configuration on the net (and no official documentation, either), so you'll probably need to analyse the DOMConfigurator source code to find out what's possible (referring to log4j examples may prove misleading, as it's not always exactly the same thing).
To conclude, log4cxx popularity in C++ world does not even come close to log4j's in Java. I wonder why (and what the heck IS popular there, except for tons of ad-hoc solutions).
This isn't actually an answer for the question but when you google for:
log4cxx xml config file syntax
this question is the top search result. As it was mentioned by #MaDa it's difficult to find an XML config file example for log4cxx and syntax description. So this is it. Simplest possible, just to log into console and into a log file.
<?xml version="1.0" encoding="UTF-8" ?>
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Output log messages to the system console. -->
<appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{1} - %m%n" />
</layout>
</appender>
<!-- Also output log messages to the log file. -->
<appender name="FileAppender" class="org.apache.log4j.FileAppender">
<param name="file" value="LogFile.log" />
<param name="append" value="true" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %C{2} (%F:%L) - %m%n" />
</layout>
</appender>
<root>
<priority value="all" />
<appender-ref ref="ConsoleAppender" />
<appender-ref ref="FileAppender" />
</root>
</log4j:configuration>
And simple usage example:
#include "log4cxx/logger.h"
#include "log4cxx/xml/domconfigurator.h"
using namespace log4cxx;
using namespace log4cxx::xml;
LoggerPtr logger (Logger::getLogger ("TEST"));
int main ()
{
DOMConfigurator::configure ("Log4cxxConfig.xml");
LOG4CXX_INFO (logger, "App started!");
LOG4CXX_ERROR (logger, "Some error!");
return 0;
}