wso2 / docs-mi

This repository contains the source code for WSO2 Micro Integrator documentation.
Apache License 2.0
4 stars 31 forks source link

Provide description on DataSourceMessageBuilder #854

Closed chanikag closed 3 days ago

chanikag commented 3 weeks ago

Description

When set enableStreaming to true in file connector configuration it gives following error

<file.read configKey="FILE_LOCAL">
                <path>home/sample.xml</path>
                <readMode>Complete File</readMode>
                <contentType>application/binary</contentType>
                <includeResultTo>Message Property</includeResultTo>
                <resultPropertyName>resultproperty</resultPropertyName>
                <enableStreaming>true</enableStreaming>
                <enableLock>false</enableLock>
            </file.read>
[2024-08-14 12:38:11,268] ERROR {ReadFile} - {proxy:sample} Error while performing file:read for file/directory file:////Users/sajithmadhusanka/Documents/CS/TICKETS/DRGSUB-158/source/file.xml org.wso2.carbon.connector.exception.FileOperationException: Required builder for streaming not found
    at org.wso2.carbon.connector.operations.ReadFile.setStreamToSynapse(ReadFile.java:601)
    at org.wso2.carbon.connector.operations.ReadFile.readFileContent(ReadFile.java:369)
    at org.wso2.carbon.connector.operations.ReadFile.connect(ReadFile.java:172)
    at org.wso2.carbon.connector.core.AbstractConnector.mediate(AbstractConnector.java:32)
    at org.apache.synapse.mediators.ext.ClassMediator.updateInstancePropertiesAndMediate(ClassMediator.java:178)
    at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:97)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
    at org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:136)
    at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:170)
    at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:93)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:110)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
    at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:228)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:396)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:210)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)

According to the source code [1] the builder is not a type of DataSourceMessageBuilder, which is why the above error is thrown.

We haven't classified which message builders are DataSourceMessageBuilders. Therefore, it would be better if we could update the MI documentation [2] with these classifications. As this issue can occur when setting up file connector, it is better to add a note in file connector docs too.

[1] https://github.com/wso2-extensions/esb-connector-file/blob/a5a7293080dccb864443f80334728ddb2861c694/src/main/java/org/wso2/carbon/connector/operations/ReadFile.java#L590 [2] https://mi.docs.wso2.com/en/latest/install-and-setup/setup/message-builders-formatters/message-builders-and-formatters/

Steps to reproduce

The steps to be followed to reproduce the issue.

Affected version(s)

The versions that are affected by the issue.

Related issue(s) (optional)

Any related issues such as sub tasks and issues reported in other repositories (e.g., component repositories), similar problems, etc.

Suggested label(s) (optional)

Optional comma-separated list of suggested labels. Non committers can’t assign labels to issues, and thereby, this will help issue creators who are not a committer to suggest possible labels.

Suggested assignee(s) (optional)

Optional comma-separated list of suggested team members who should attend the issue. Non committers can’t assign issues to assignees, and thereby, this will help issue creators who are not a committer to suggest possible assignees.

chanikag commented 3 days ago

Usually, we do not have to specify, these implementation level details in the product documentation. As we have already done, what we have to do is we have to mention what to configure when we add a particular property (ie. the content type should be set to application/binary if enableStreaming is set to true.). That is already there in the documentation.