TDM - Usage of Maps with database output structures in test / prod env
Good morning all, we are using the Talend Data Mapper for the first time in an ESB project to map different files and messages between different systems. One example would be an incoming sales order received as an EDIFACT flat file which will be mapped via TDM an written directly to a database table by using the output structure representation "database". This works really well and we like the fact that we don't need to write any sql code. On the other hand we are wondering how it is possible to use different environments (like test, quality and production) within the TDM. In the test environment we don't want to write into the productive database tables but in the test tables (same table structure, just different schema in the Oracle DB). For all the other camel components, e.g. when we write an XML file, we can just use the different file paths we configured in the context. What would be the best practise in TDM? Of course we want to avoid using determining the current environment and then explicitly use different structures / maps inside a route. This would be duplicate code since in fact everything would be the same except for the table to write in. We played a lot with TDM to find a suitable way but couldn't get anything to work. One approach was adding another database representation to the structure and just change the name of the table in its properties. Unfortunately this did'nt work and brought us errors like:
Bug - should not occur Thread Impossible 200 FATAL com.oaklandsw.util.Util - Bug - should not occur (No Exception): Thread Impossible
Another idea was to use I/O expression and somehow determine the output structure and / or the output representation dynamically inside the route. But we didn't really understand how this would work. Is it clear what we are trying to achieve? Do you have any ideas or suggestions? Thanks a lot!
Re: TDM - Usage of Maps with database output structures in test / prod env
Hi Eric, thank you for the fast response. Before I can try to build a PoC to see if this solution would work for us I have one question / issue: Since we do not have a job but a route (so we use the cMap component) we can't access the context within the TDM (please correct me if I'm wrong). The documentation says that in case of tHMap component the context will be passed to the MapProperties and in case of cMap / Camel context the exchange properties will be passed to the map. So i tried to set a Propery called "environment" with the value of the context variable "env". Unfortunately I can't access / "find" the porperty in TDM. I uploaded some screenshots here: and here: . Could you please tell me what I did wrong? Thanks a lot!