How do I create Soap/WSDL event handlers with Delphi similar to C#? - web-services

I am dealing with a cash infinity note and coin acceptor. I am sending a cashin request to the machine which works fine. But I am failing to create an event handler which keeps polling the deposited amount until i am done. I have a C# code of handling wsdl events after an operation. I have been trying to replicate that in Delphi but I can only do the operation bit not the event handling.
Here the WSDL file
Below is one of the C# WSDL operation with and event handler. From [Form.cs]
//'
//' Start Cashin
//'
private void btnBeginDeposit_Click(object sender, EventArgs e)
{
com.glory.fcc.service.StartCashinRequestType objDepositRequest = new com.glory.fcc.service.StartCashinRequestType();
objDepositRequest.Id = GetId();
objDepositRequest.SeqNo = GetSequenceNumber();
try
{
clsBrueBoxService.StartCashinOperationAsync(objDepositRequest);
exclusionProcessing(false);
printer.PrintHeader();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}
}
//'
//' Start Cashin - Complete Event
//'
void StartCashinOperationCompletedEventHandler(object sender, com.glory.fcc.service.StartCashinOperationCompletedEventArgs arg)
{
currentManualAmount = 0;
currencyManualDetailList.Clear();
operateManualInputArea(false, true);
btnReturnDeposit.Enabled = true;
btnFixSales.Enabled = true;
txtNumber.Enabled = true;
txtAmount.Enabled = true;
txtCount.Enabled = true;
Refresh();
txtNumber.Focus();
}
From [Reference.cs]
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.9032.0")]
public delegate void GetStatusCompletedEventHandler(object sender, GetStatusCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.9032.0")]
public delegate void StartCashinOperationCompletedEventHandler(object sender, StartCashinOperationCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.9032.0")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class StartCashinOperationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal StartCashinOperationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public StartCashinResponseType Result {
get {
this.RaiseExceptionIfNecessary();
return ((StartCashinResponseType)(this.results[0]));
}
}
}
And here is my Delphi operation
//'
//' Start Cashin
//'
{-------------------------------------------------------------------------------------------------}
procedure TfrmMAIN000.btnBeginDepositClick(Sender: TObject);
var
objDepositRequest :StartCashinRequest;
objDepositResponse :StartCashinResponse;
begin
objDepositRequest := StartCashinRequest.Create;
objDepositRequest.Id := GetId();
objDepositRequest.SeqNo := GetSequenceNumber();
objDepositRequest.SessionID := sSessionID;
try
HTTPRIO.HTTPWebNode.ReceiveTimeout := 6000000;
objDepositResponse := clsBrueBoxService.StartCashinOperation(objDepositRequest);
if objDepositResponse.result = FCC_SUCCESS then
begin
exclusionProcessing(false);
printer.PrintHeader();
StartCashinOperationCompletedEventHandler(Sender,objDepositResponse);
end
else
begin
ShowMessage('FCC_Error: ' + IntToStr(objDepositResponse.result))
end;
except on E: Exception do
ShowMessage(E.Message);
end;
end;
//'
//' Start Cashin - Complete Event
//'
{-------------------------------------------------------------------------------------------------}
procedure TfrmMAIN000.StartCashinOperationCompletedEventHandler(Sender :Tobject; AStartCashinResponse :StartCashinResponse);
begin
currentManualAmount := 0;
currencyManualDetailList.Clear();
operateManualInputArea(false, true);
btnReturnDeposit.Enabled := true;
btnFixSales.Enabled := true;
txtNumber.Enabled := true;
txtAmount.Enabled := true;
txtCount.Enabled := true;
Refresh();
txtNumber.SetFocus();
end;
Below I did a unit to create Delphi equivalent to C# delagates to handle events but I am new to delphi and do not know if I am doint it wrong or calling them wrong.
unit EventHandleClass;
interface
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, BrueBoxService;
type
TSetStatusCallback = procedure(i :Integer; xText :string) of object;
TSetGuidanceCallback = procedure(xText :string) of object;
TSetDepositCallback = Procedure(xText :string) of object;
TShowRecoveryScreenCallback= Procedure(xText, xText2 :string) of object;
TSetRefillCallback= Procedure of object;
TSetWarningLabelCallback= Procedure(xflg :Integer; devid, fv :string) of object;
TGetStatusEvent = procedure(ASender: TObject; AStatusRespose: StatusResponse) of object;
TStartCashinOperationCompletedEvent = procedure(ASender: TObject; AStatusRespose: StatusResponse) of object;
TEventHandleClass = class
private
FOnSetStatusCallbackEvent: TSetStatusCallback;
FOnSetGuidanceCallbackEvent: TSetGuidanceCallback;
FOnSetDepositCallbackEvent: TSetDepositCallback;
FOnShowRecoveryScreenCallbackEvent: TShowRecoveryScreenCallback;
FOnSetRefillCallbackEvent: TSetRefillCallback;
FOnSetWarningLabelCallbackEvent: TSetWarningLabelCallback;
FOnGetStatusEventEvent: TGetStatusEvent;
FOnStartCashinOperationCompletedEvent: TStartCashinOperationCompletedEvent;
published
property OnSetStatusCallback : TSetStatusCallback read FOnSetStatusCallbackEvent write FOnSetStatusCallbackEvent;
property OnSetGuidanceCallback : TSetGuidanceCallback read FOnSetGuidanceCallbackEvent write FOnSetGuidanceCallbackEvent;
property OnSetDepositCallback : TSetDepositCallback read FOnSetDepositCallbackEvent write FOnSetDepositCallbackEvent;
property OnShowRecoveryScreenCallback : TShowRecoveryScreenCallback read FOnShowRecoveryScreenCallbackEvent write FOnShowRecoveryScreenCallbackEvent;
property OnSetRefillCallback : TSetRefillCallback read FOnSetRefillCallbackEvent write FOnSetRefillCallbackEvent;
property OnSetWarningLabelCallback : TSetWarningLabelCallback read FOnSetWarningLabelCallbackEvent write FOnSetWarningLabelCallbackEvent;
property OnGetStatusEvent: TGetStatusEvent read FOnGetStatusEventEvent write FOnGetStatusEventEvent;
property OnStartCashinOperationCompletedEvent: TStartCashinOperationCompletedEvent read FOnStartCashinOperationCompletedEvent write FOnStartCashinOperationCompletedEvent;
end;
implementation
end.
Any kind of assistance will greatly be appreciated.
I have tried sending a soap/WSDL request to a cash acceptor and trying to handle with event when the process is complete at the cash acceptor.

Related

AWS SDK2 java s3 select example - how to get result bytes

I am trying to use aws sdk2 java for s3 select operations but not able to get extract the final data. Looking for an example if someone has implemented it. I got some idea from [this post][1] but not able to figure out how to get and read the full data .
Fetching specific fields from an S3 document
Basically, equivalent of v1 sdk:
``` InputStream resultInputStream = result.getPayload().getRecordsInputStream(
new SelectObjectContentEventVisitor() {
#Override
public void visit(SelectObjectContentEvent.StatsEvent event)
{
System.out.println(
"Received Stats, Bytes Scanned: " + event.getDetails().getBytesScanned()
+ " Bytes Processed: " + event.getDetails().getBytesProcessed());
}
/*
* An End Event informs that the request has finished successfully.
*/
#Override
public void visit(SelectObjectContentEvent.EndEvent event)
{
isResultComplete.set(true);
System.out.println("Received End Event. Result is complete.");
}
}
);```
///IN AWS SDK2, how do get ResultOutputStream ?
```public byte[] getQueryResults() {
logger.info("V2 query");
S3AsyncClient s3Client = null;
s3Client = S3AsyncClient.builder()
.region(Region.US_WEST_2)
.build();
String fileObjKeyName = "upload/" + filePath;
try{
logger.info("Filepath: " + fileObjKeyName);
ListObjectsV2Request listObjects = ListObjectsV2Request
.builder()
.bucket(Constants.bucketName)
.build();
......
InputSerialization inputSerialization = InputSerialization.builder().
json(JSONInput.builder().type(JSONType.LINES).build()).build()
OutputSerialization outputSerialization = null;
outputSerialization = OutputSerialization.builder().
json(JSONOutput.builder()
.build()
).build();
SelectObjectContentRequest selectObjectContentRequest = SelectObjectContentRequest.builder()
.bucket(Constants.bucketName)
.key(partFilename)
.expression(query)
.expressionType(ExpressionType.SQL)
.inputSerialization(inputSerialization)
.outputSerialization(outputSerialization)
.scanRange(ScanRange.builder().start(0L).end(Constants.limitBytes).build())
.build();
final DataHandler handler = new DataHandler();
CompletableFuture future = s3Client.selectObjectContent(selectObjectContentRequest, handler);
//hold it till we get a end event
EndEvent endEvent = (EndEvent) handler.receivedEvents.stream()
.filter(e -> e.sdkEventType() == SelectObjectContentEventStream.EventType.END)
.findFirst()
.orElse(null);```
//Now, from here how do I get the response bytes ?
///////---> ISSUE: How do I get ResultStream bytes ????
return <bytes>
}```
// handler
private static class DataHandler implements SelectObjectContentResponseHandler {
private SelectObjectContentResponse response;
private List receivedEvents = new ArrayList<>();
private Throwable exception;
#Override
public void responseReceived(SelectObjectContentResponse response) {
this.response = response;
}
#Override
public void onEventStream(SdkPublisher<SelectObjectContentEventStream> publisher) {
publisher.subscribe(receivedEvents::add);
}
#Override
public void exceptionOccurred(Throwable throwable) {
exception = throwable;
}
#Override
public void complete() {
}
} ```
[1]: https://stackoverflow.com/questions/67315601/fetching-specific-fields-from-an-s3-document
i came to your post since I was working on the same issue as to avoid V1.
After hours of searching i ended up with finding the answer at. https://github.com/aws/aws-sdk-java-v2/pull/2943/files
The answer is located at SelectObjectContentIntegrationTest.java File
services/s3/src/it/java/software/amazon/awssdk/services/SelectObjectContentIntegrationTest.java
The way to get the bytes is by using the RecordsEvent class, please note for my use case I used CSV, not sure if this would be different for a different file type.
in the complete method you have access to the receivedEvents. this is where you get the first index to get the filtered returned results and casting it to the RecordsEvent class. then this class provides the payload as bytes
#Override
public void complete() {
RecordsEvent records = (RecordsEvent) this.receivedEvents.get(0)
String result = records.payload().asUtf8String();
}

BulkProcessor .add() not finishing when number of bulks > concurrentRequests

Here is a sample of the code flow:
Trigger the process with an API specifying bulkSize and totalRecords.
Use those parameters to acquire data from DB
Create a processor with the bulkSize.
Send both the data and processor into a method which:
-iterates over the resultset, assembles a JSON for each result, calls a method if the final JSON is not empty and adds that final JSON to the process using processor.add() method.
This is where the outcome of the code is split
After this, if the concurrentRequest parameter is 0 or 1 or any value < (totalRecords/bulkSize), the processor.add() line is where the code stalls and never continues to the next debug line.
However, when we increase the concurrentRequest parameter to a value > (totalRecords/bulkSize), the code is able to finish the .add() function and move onto the next line.
My reasoning leads me to believe we might be having issues with our BulkProcessListener which is making the .add() no close or finish like it is supposed to. I would really appreciate some more insight about this topic!
Here is the Listener we are using:
private class BulkProcessorListener implements Listener {
#Override
public void beforeBulk(long executionId, BulkRequest request) {
// Some log statements
}
#Override
public void afterBulk(long executionId, BulkRequest request, BulkResponse response) {
// More log statements
}
#Override
public void afterBulk(long executionId, BulkRequest request, Throwable failure) {
// Log statements
}
}
Here is the createProcessor():
public synchronized BulkProcessor createProcessor(int bulkActions) {
Builder builder = BulkProcessor.builder((request, bulkListener) -> {
long timeoutMin = 60L;
try {
request.timeout(TimeValue.timeValueMinutes(timeoutMin));
// Log statements
client.bulkAsync(request, RequestOptions.DEFAULT,new ResponseActionListener<BulkResponse>());
}catch(Exception ex) {
ex.printStackTrace();
}finally {
}
}, new BulkProcessorListener());
builder.setBulkActions(bulkActions);
builder.setBulkSize(new ByteSizeValue(buldSize, ByteSizeUnit.MB));
builder.setFlushInterval(TimeValue.timeValueSeconds(5));
builder.setConcurrentRequests(0);
builder.setBackoffPolicy(BackoffPolicy.noBackoff());
return builder.build();
}
Here is the method where we call processor.add():
#SuppressWarnings("deprecation")
private void addData(BulkProcessor processor, String indexName, JSONObject finalDataJSON, Map<String, String> previousUniqueObject) {
// Debug logs
processor.add(new IndexRequest(indexName, INDEX_TYPE,
previousUniqueObject.get(COMBINED_ID)).source(finalDataJSON.toString(), XContentType.JSON));
// Debug logs
}

Logging handler usage

my question is similar to Why does java.util.logging.Logger print to stderr? post.
I want to use only one handler in my logging, where as it should print INFO statements on to out stream and WARNING & SEVERE onto error stream.
Is this possible ?
If I take two handlers for example,
one for out stream - and level as INFO
another for error stream - and level as WARNING/SEVERE in this case, application is showing messages twice
one with out stream and another with error stream.
So any solution ?
This is possible with one or two handlers. The missing part is that you need to create a filter for the OUT handler that limits the highest level. Also you need to make sure there are no other ConsoleHandlers attached to the root logger which can pollute your test. You can print the logger tree to see what handlers are attached.
Here is a proof of concept:
import java.io.PrintStream;
import java.util.logging.ConsoleHandler;
import java.util.logging.Filter;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
public class OutErrorTest {
private static final Logger log = Logger.getLogger("");
public static void main(String[] args) {
LogManager.getLogManager().reset(); //A quick way to remove all handlers.
Handler out = newSystemOut();
Handler err = newSystemErr();
final Level fence = Level.WARNING;
out.setLevel(Level.ALL);
out.setFilter(new LessThanLevelFilter(fence));
err.setLevel(fence);
log.addHandler(out);
log.addHandler(err);
log.setLevel(Level.ALL);
log.finest("Finest Log");
log.finer("Finer Log");
log.fine("Fine Log");
log.config("Config Log");
log.info("Info Log");
log.warning("Warning Log");
log.severe("Severe Log");
}
private static Handler newSystemErr() {
return new ConsoleHandler();
}
private static Handler newSystemOut() {
Handler h = null;
final PrintStream err = System.err;
System.setErr(System.out);
try {
h = new ConsoleHandler(); // Snapshot of System.err
} finally {
System.setErr(err);
}
return h;
}
public static class LessThanLevelFilter implements Filter {
private final int lvl;
public LessThanLevelFilter(final Level max) {
this(max.intValue());
}
public LessThanLevelFilter(final int max) {
this.lvl = max;
}
#Override
public boolean isLoggable(LogRecord r) {
return r.getLevel().intValue() < lvl;
}
}
}

Graceful termination

I am trying to implement the following use case as part of my akka learning
I would like to calculate the total streets in all cities of all states. I have a database that contain the details needed. Here is what i have so far
Configuration
akka.actor.deployment {
/CityActor{
router = random-pool
nr-of-instances = 10
}
/StateActor {
router = random-pool
nr-of-instances = 1
}}
Main
public static void main(String[] args) {
try {
Config conf = ConfigFactory
.parseReader(
new FileReader(ClassLoader.getSystemResource("config/forum.conf").getFile()))
.withFallback(ConfigFactory.load());
System.out.println(conf);
final ActorSystem system = ActorSystem.create("AkkaApp", conf);
final ActorRef masterActor = system.actorOf(Props.create(MasterActor.class), "Migrate");
masterActor.tell("", ActorRef.noSender());
} catch (Exception e) {
e.printStackTrace();
}
}
MasterActor
public class MasterActor extends UntypedActor {
private final ActorRef randomRouter = getContext().system()
.actorOf(Props.create(StateActor.class).withRouter(new akka.routing.FromConfig()), "StateActor");
#Override
public void onReceive(Object message) throws Exception {
if (message instanceof String) {
getContext().watch(randomRouter);
for (String aState : getStates()) {
randomRouter.tell(aState, getSelf());
}
randomRouter.tell(new Broadcast(PoisonPill.getInstance()), getSelf());
} else if (message instanceof Terminated) {
Terminated ater = (Terminated) message;
if (ater.getActor().equals(randomRouter)) {
getContext().system().terminate();
}
}
}
public List<String> getStates() {
return new ArrayList<String>(Arrays.asList("CA", "MA", "TA", "NJ", "NY"));
};}
StateActor
public class StateActor extends UntypedActor {
private final ActorRef randomRouter = getContext().system()
.actorOf(Props.create(CityActor.class).withRouter(new akka.routing.FromConfig()), "CityActor");
#Override
public void onReceive(Object message) throws Exception {
if (message instanceof String) {
System.out.println("Processing state " + message);
for (String aCity : getCitiesForState((String) message)) {
randomRouter.tell(aCity, getSelf());
}
Thread.sleep(1000);
}
}
public List<String> getCitiesForState(String stateName) {
return new ArrayList<String>(Arrays.asList("Springfield-" + stateName, "Salem-" + stateName,
"Franklin-" + stateName, "Clinton-" + stateName, "Georgetown-" + stateName));
};}
CityActor
public class CityActor extends UntypedActor {
#Override
public void onReceive(Object message) throws Exception {
if (message instanceof String) {
System.out.println("Processing city " + message);
Thread.sleep(1000);
}
}}
Did i implement this use case properly?
I cannot get the code to terminate properly, i get dead letters messages. I know why i am getting them, but not sure how to properly implement it.
Any help is greatly appreciated.
Thanks
I tested and ran your use case with Akka 2.4.17. It works and terminate properly, without any dead letters logged.
Here are some remarks/suggestions to improve your understanding of the Akka toolkit:
Do not use Thread.sleep() inside an actor. Basically, it is never a good practice since a same thread may do many tasks for many actors (this is the default behavior with a shared thread pool). Instead, you can use an Akka scheduler or assign a single thread to a specific Actor (see this post for more details). See also the Akka documentation about that topic.
Having some dead letters is not always an issue. It generally arises when the system stops an Actor that had some messages within its mailbox. In this case, the remaining unprocessed messages are sent to deadLetters of the ActorSystem. I recommend you to check the configuration you provided for the logging of dead letters. If the file forum.conf you provided is your complete configuration file for Akka, you may want to customize some additional settings. See the page Logging of Dead Letters and Stopping actors on Akka's website. For instance, you could have a section like this:
akka {
# instead of System.out.println(conf);
log-config-on-start = on
# Max number of dead letters to log
log-dead-letters = 10
log-dead-letters-during-shutdown = on
}
Instead of using System.out.println() to log/debug, it is more convenient to set up a dedicated logger for each Actor that provides you additional information such as dispatchers, Actor name, etc. If your are interested, have a look to the Logging page.
Use some custom immutable message objects instead of systematic Strings. At first, it may seem painful to have to declare new additional classes but in the end it helps to better design complex behaviors and it's more readable. For instance, an actor A can answer to a RequestMsg coming from an actor B with an AnswerMsg or a custom ErrorMsg. Then, for your actor B, you will end up with the following onReceive() method:
#Override
public void onReceive(Object message) {
if (message instanceof AnswerMsg) {
// OK
AnswerMsg answerMsg = (AnswerMsg) message;
// ...
}
if (message instanceof ErrorMsg) {
// Not OK
ErrorMsg errorMsg = (ErrorMsg) message;
// ...
}
else {
// Unexpected behaviour, log it
log.error("Error, received " + message.toString() + " object.")
}
}
I hope that these resources will be useful for you.
Have a happy Akka programming! ;)

How to unmarshal from CSV to Bean with Apache Camel and Bindy?

I'm trying to write my first code with Apache Camel right now. I try to follow the examples from Camel in Action, but I want to use my own example data.
What I want to do
Right now I want to read from a CSV file and get each line as a java bean.
Here is my junit test:
#Test
public void testCsvWithBindy() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:queue.csv");
mock.expectedMessageCount(2);
assertMockEndpointsSatisfied();
CsvBean line1 = mock.getReceivedExchanges().get(0).getIn()
.getBody(CsvBean.class);
assertEquals("row 01", line1.getFirst());
}
public RouteBuilder createRoute() {
return new RouteBuilder() {
public void configure() throws Exception {
context.setTracing(true);
from("file://src/test/resources?noop=true&fileName=test.csv")
.unmarshal().bindy(BindyType.Csv, "my.package.for.csvrecord")
.to("mock:queue.csv");
}
};
}
The CSV contains this:
row 01,row 02,,row 04
row 11, row 12, row 13, row 14
And this is my CsvRecord:
#CsvRecord(separator = ",")
public class CsvBean {
#DataField(pos = 1)
private String first;
#DataField(pos = 2)
private String second;
#DataField(pos = 3)
private String third;
#DataField(pos = 4)
private String fourth;
public String getFirst() {
return first;
}
public void setFirst(String first) {
this.first = first;
}
public String getSecond() {
return second;
}
public void setSecond(String second) {
this.second = second;
}
public String getThird() {
return third;
}
public void setThird(String third) {
this.third = third;
}
public String getFourth() {
return fourth;
}
public void setFourth(String fourth) {
this.fourth = fourth;
}
}
My Problem
When I run this test, the context is started and the route is loaded. But nothing is coming through. After about 10s the context is automatically stopped and my test fails. This is the stacktrace:
java.lang.AssertionError: mock://queue.csv Received message count. Expected: <2> but was: <0>
at org.apache.camel.component.mock.MockEndpoint.fail(MockEndpoint.java:1086)
at org.apache.camel.component.mock.MockEndpoint.assertEquals(MockEndpoint.java:1068)
at org.apache.camel.component.mock.MockEndpoint.doAssertIsSatisfied(MockEndpoint.java:367)
at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:346)
at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:334)
at org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied(MockEndpoint.java:172)
at org.apache.camel.test.junit4.CamelTestSupport.assertMockEndpointsSatisfied(CamelTestSupport.java:391)
at my.package.for.unittests.CsvToBeanWithBindyTest.testCsvWithBindy(CsvToBeanWithBindyTest.java:20)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Need help with
I guess I'm missing something obvious, maybe something that has to do with the test setup and not so much with my CsvRecord or my route. Can you give me a tip or maybe an URL to a better tutorial? The book is not very helpful at this point... :-(
Again, right after posting my question, I found the answer myself. ;-) Here is a working junit test:
public class CsvToBeanWithBindyTest extends CamelTestSupport {
#Test
public void testCsv() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:queue.csv");
mock.expectedMessageCount(1);
assertMockEndpointsSatisfied();
List line1 = (List) mock.getReceivedExchanges().get(0).getIn()
.getBody();
Map map1 = (Map) line1.get(0);
CsvBean csv1 = (CsvBean) map1.get("my.package.CsvBean");
assertEquals("row 01", csv1.getFirst());
Map map2 = (Map) line1.get(1);
CsvBean csv2 = (CsvBean) map2.get("my.package.CsvBean");
assertEquals("row 11", csv2.getFirst());
}
#Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
#Override
public void configure() throws Exception {
context.setTracing(true);
from("file://src/test/resources?noop=true&fileName=test.csv")
.unmarshal(new BindyCsvDataFormat("my.package"))
.to("mock:queue.csv");
}
};
}
}
The unexpected thing for me is that I get a List from my endpoint route which in turn holds many Maps. Each map has a key my.package.MyBeanClass with the value set to the actual unmarshalled row from my CSV file.