Can you help me please?
I'm trying create a simple siddhi app on wso2 sp 4.4.0. I'm trying to load two files from two folders and after loading the data, the file will be deleted but only one folder is loaded.the second folder is not loaded. Do you know how i can working with two files please?
My siddhi app
#App:name("SiddhiApp")
#App:description("SiddhiApp / test")
#source(type='file', mode='LINE',
dir.uri='file://C:\Users\john\wso2sp-test\firstFolder',
tailing='false',
action.after.process='delete',
#map(type='csv',delimiter=";"))
define stream filestream (name string, surname string);
#source(type='file', mode='LINE',
dir.uri='file://C:\Users\john\wso2sp-test\secondFolder',
tailing='false',
action.after.process='delete',
#map(type='csv',delimiter=";"))
define stream filestreamSec (id string, name string);
#sink(type='log')
define stream logStream(id string, name string);
from filestreamSec
select *
insert into logStream;
from filestream
select *
insert into logStream;
We have fixed several bugs after the siddhi-io-file-1.1.1.jar which we released with wso2sp-4.4.0.
The current stable version is siddhi-io-file-2.0.10.
I did check your scenario and it works with the latest siddhi-io-file-2.0.10 version.
This can be used with wso2si-1.0.0. This io-file version cannot be used with wso2sp-4.4.0 because there are major API changes with the siddhi version used with io-file-2.0.10 and which is packed in the distribution.
FYI: WSO2 Streaming Integrator is the successor if WSO2 Stream Processor.
Please let us know if you need further information/guidance.
Best Regards,
Ramindu.
this functionality does not work, SP can check always only one directory at a time. Even if you create separate siddhi apps.
This feature is really missing.
Related
My dev conf : Win2010, WSO2 EI 6.4.0, linux for data store.
I defined a registry entry, named "sourcefileURI" for storing source filepath. The media type I chose is "text/plain" and I store a path like : "/home/wso2/data/in"
When accessing this registry value from a inbound endpoint vfs config, I'm using the following code :
<parameter key="conf:/repository/transports/vfs/telco1/sourcefileURI" name="transport.vfs.FileURI"/>
This is working - almost - fine. I mean the value is returned but in base64.
I was expecting, since I chose media = "text/plain", to have the normal string returned.
The string is well returne - in plain text and not encoded - when I swap media to nothing/void. But this is not something I want to last in my project.
Can you please tell me what I'm doing wrong / don't understand here ?
Many thanks for your help.
1).Check the message builder and formatter you are using in conf/axis2.xml.Try to change the message builder and formatter for text/plain.
2) Otherwise simple solution is to use the xpath function base64Decode(string encodedValue).
3) Otherwise Use script mediator to decode the string or use class mediator.
4) Otherwise use the following link https://ajanthane.blogspot.com/2017/05/accessing-modifying-payload-in.html, in which explains how to create a custom synapse handlers.
I am currently attempting to use transactions in my C++ app, but I have a problem with the ODBC's auto commit mode.
I am using the POCO libaries to create a connection to a PostgreSQL database on the same machine. Currently, I can send data to this database as single statements, but I cannot get my head around how to use Poco's transaction libraries to be able to send this data more quickly.
As I have several thousand records to insert, and so continuing to use single insert statements is extrememly slow and inpractical - So I am trying to use Poco's transaction to speed this up a bit (a fair bit).
The error I am encountering is a theoretically a simple one - Poco is throwing the following error:
'Invalid access: Session is in auto commit mode.'
I understand, as a result of this, I should somehow set "auto commit" to false - as it only allows me to commit data to the database line by line, rather than as a single transaction.
The problem is how I set this.
Currently, I have a session created from Session.h, that looks alot like this:
session = new Poco::Data::Session(
"ODBC",
connection_data.str()
);
Where connection data is a simple stringstream with the login information, password, database, server and "Driver={PostgreSQL ANSI};" to tell ODBC to utilize PostgreSQL's driver.
I have tried just setting a property "autocommit" to false through the session's setFeature or setProperty settings, this, of course, was to no avail. (it was more of a ditch attempt at this point).
session->setFeature("AUTOCOMMIT", false);
Looking around, I saw a possible alternative method by creating a ODBC sessionImpl directly from ODBC/session/SessionImpl.h instead of using this generic method above, and then creating a new session object from this.
The benefits of this are that ODBC's sessionImpl has references to autocommit mode in the header, which would suggest it would be able to handle this:
void autoCommit(const std::string&, bool val);
/// Sets autocommit property for the session.
However, having not used sessionImpl before, I cannot garuntee if this will work or if can can get this to work with the limited documentation available.
I am using C++ 03 (Not 11), with Visual Studio 2015
Poco 1.7.5
Boost (Where needed)
Would any one know the correct way of setting this feature (above) or a alternative method to achieving this?
edit: Looking at the source of poco, at:
https://github.com/pocoproject/poco/blob/develop/Data/ODBC/src/SessionImpl.cpp#L153
The property seems be named autoCommit, and looking at
https://github.com/pocoproject/poco/blob/develop/Data/include/Poco/Data/AbstractSessionImpl.h#L120
the case of the property names seem to matter. So, does it help if you use session->setFeature("autoCommit", false);?
Cant you just call session->begin(); and session->end(); on the corresponding Session object?
What is returned by session->canTransact()?
According to the doc begin() will start a new transaction, the doc does not mention any property that needs to be set before or after.
See: https://pocoproject.org/docs/Poco.Data.Session.html
Also faced a similar issue.
First of all before begin() need:
m_ses.setFeature("autoCommit", false);
m_ses.begin();
And the second issue is that this feature stays "autoCommit" in false for all other sessions. So don't forget for the next session call
session.setFeature("autoCommit", true);
What I'm trying to do is find all .db (Paradox) files from a directory and save them to .mdb. The thing is, to try if this works properly I've tried first opening an ACCDB (.db and .mdb I'll be using are resources only available in my school's internal network).
I've already checked, and I've found the sql drivers in the Qt directory, I've also added QT +=sql in my pro file, I've installed the access database engine, VBA is also installed, but I can't manage to open the connection. I'm yet to try connecting to a SQLITE database to try if it works, but I'm guessing it will. Here is the code, triggered from a button:
db.addDatabase("QODBC");
explorador.setFileMode(QFileDialog::Directory);
ruta=explorador.getExistingDirectory(this,"Seleccionar directorio");
directorio.setPath(ruta);
subdir=directorio.entryList(QDir::AllDirs);
//La lista comienza en el 2ยบ elemento
for(int i=2;i<subdir.size();i++)
{
subruta=ruta+"/"+subdir.at(i);
directorio.setPath(subruta);
db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+subruta+"/Base de datos11.accdb");
bool check=db.open();
if(check)
{
dbg.setText("Prueba");
dbg.show();
}
else
{
dbg.setText("Pruebaaa");
dbg.show();
}
}
Have any ideas?? Thank you!
I eventually solved it kind of bypassing through access. If someone else is struggling with this you need:
-Paradox DB engine (Be sure the version you download matches your .db file)
-Jet engine 4.0 or later
-access 2007 (Following version have removed Paradox DB connection)
-Administrator privileges to access the database engine folders(both jet and paradox)
Simply open the database through a connection or database object. Sintax should be something like this (Via a VBA module in access):
database.open(path,*Dont rememer what goes in here,*here goes the read/write permits,"Paradox 5.x")
Path should be pointing to a folder containing one or more .db files, which will be opened as a a single database with the files being tables. It actually genereates a new database (Either .accdb or .mdb, depending how you save it)
It is not exactly like this, but I'm on my laptop. I'll edit the answer once I'm in front of my code
Sorry it is not a c++ answer, but from what I've found it is kind of a pain in the a** to work with paradox databases. Hope this helps others with the struggle.
Ricardo
I need to create a simple web service (being the "server"). The goal is to provide some data I do read in an Qt / C++ application as JSON data. Basically a JavaScript application in the browser shall read its data from the Qt app. It is usually a single user scenario, so the user runs a Google Maps application in her browser, while additional data come from the Qt application.
So far I have found these libs:
Qxt: http://libqxt.bitbucket.org/doc/0.6/index.html but being a newbie on C++/Qt I miss some examples. Added: I have found one example here
gSoap: http://www.cs.fsu.edu/~engelen/soap.html has more examples and documentation and also seems to support JSON
KD SOAP: http://www.kdab.com/kdab-products/kd-soap/ with no example as far as I can tell, docu is here
Qt features itself, but it is more about acting as a client: http://qt-project.org/videos/watch/qt-networking-web-services
Checking SO gives me basically links to the above libs
webservice with Qt with an example I do not really get.
How to Create a webservice by Qt
So basically I do have the following questions:
Which lib would you use? I want to keep it as simple as possible and would need an example.
Is there another (easy!) way to provide the JSON data to the JavaScript Web page besides the WebService?
-- Edit, remarks: ---
Needs to be application intrinsic. No web server can be installed, no extra run time can be used. The user just runs the app. Maybe the Qt WebKit could be an approach....
-- Edit 2 --
Currently checking the tiny web servers as of SO " Qt HTTP Server? "
As of my tests, currently I am using QtWebApp: http://stefanfrings.de/qtwebapp/index-en.html This is one of the answers of Edit 2 ( Qt HTTP Server? )
Stefan's small WebServer has some well documented code, is written in "Qt C++" and easy to use, especially if you have worked with servlets already. Since it can be easily integrated in my Qt project, I'll end up with an internal WebServer.
Some demo code from my JSON tests, showing that generating the JSON content is basically creating a QString.
void WebServiceController::service(HttpRequest& request, HttpResponse& response) {
// set some headers
response.setHeader("Content-Type", "application/json; charset=ISO-8859-1");
response.setCookie(HttpCookie("wsTest","CreateDummyPerson",600));
QString dp = WebServiceController::getDummyPerson();
QByteArray ba = dp.toLocal8Bit();
const char *baChar = ba.data();
response.write(ba);
}
If someone has easy examples with other libs to share, please let me know.
QByteArray ba = dp.toLocal8Bit();
const char *baChar = ba.data();
You don't need to convert the QByteArray to char array. Response.write() can also be called with a QByteArray.
By the way: qPrintable(dp) is a shortcut to convert from QString to char array.
Hey, I've got this nice little piece of code, much like all the other versions of this method of upload using WSS WebServices. I've got one major problem though - once I have uploaded a file into my doc list, and updated the list item to write a comment/description, the file is stuck there. What I mean is that this method will not overwrite the file once I've uploaded it. Nobody else out there seems to have posted this issue yet, so .. anyone?
I have another version of the method which uses a byte[] instead of a Stream .. same issue though.
Note: I have switched off the 'require documents to be checked out before they can be edited' option for the library. No luck tho .. The doc library does have versioning turned on though, with a major version being created for each update.
private void UploadStream(string fullPath, Stream uploadStream)
{
WebRequest request = WebRequest.Create(fullPath);
request.Credentials = CredentialCache.DefaultCredentials; // User must have 'Contributor' access to the document library
request.Method = "PUT";
request.Headers.Add("Overwrite", "t");
byte[] buffer = new byte[4096];
using (Stream stream = request.GetRequestStream())
{
for (int i = uploadStream.Read(buffer, 0, buffer.Length); i > 0; i = uploadStream.Read(buffer, 0, buffer.Length))
{
stream.Write(buffer, 0, i);
}
}
WebResponse response = request.GetResponse(); // Upload the file
response.Close();
}
Original credits to: http://geek.hubkey.com/2007/10/upload-file-to-sharepoint-document.html
EDIT -- major finding .. when I call it from my nUnit test project it works fine. It seems it only fails when I call it from my WCF application (nUnit running under logged on user account, WCF app has app pool running under that same user -- my account, which also has valid permissions in SharePoint).
Nuts. "Now where to start?!", I muses to myself.
SOLVED -- I found a little bug - the file was being created in the right place, but the update path was wrong.. I ended up finding a folder full of files with many, many new versions.. doh!
Why not use the out-of-the-box SharePoint webservice, Lists.asmx? You'll find it in
http://SITEURL/___vti_bin/Lists.asmx
Edit, I checked out the link and it seems you are calling the out of the box web service. This has got be versioning related then. Can you check out the different versions that exist in the doc lib of the specific file? see if it perhaps gets added as a minor version through the service?
Have you tried using a capital T? SharePoint's webdav header processing is not very likely to be case-sensitive, but the protocol does specify a capital T. Oh, and what is the response? A 412 error code or something altogether different?