achilleasa / dart_cassandra_cql Goto Github PK
View Code? Open in Web Editor NEWCassandra CQL driver for Dart
License: MIT License
Cassandra CQL driver for Dart
License: MIT License
Hello,
Sometimes (it's not 100% reproducible) I have this error:
Unhandled exception:
Uncaught Error: Bad state: StreamSink is bound to a stream
Stack Trace:
#0 _StreamSinkImpl._controller (dart:io/io_sink.dart:219)
#1 _StreamSinkImpl.add (dart:io/io_sink.dart:143)
#2 _Socket.add (dart:io-patch/socket_patch.dart:1644)
#3 ChunkedOutputWriter.pipe.<anonymous closure> (package:dart_cassandra_cql/driver/stream/chunked_output_writer.dart:53:65)
#4 ListQueue.forEach (dart:collection/queue.dart:404)
#5 ChunkedOutputWriter.pipe (package:dart_cassandra_cql/driver/stream/chunked_output_writer.dart:53:28)
#6 FrameWriter.writeMessage (package:dart_cassandra_cql/driver/protocol/frame/frame_writer.dart:96:29)
#7 Connection._writeMessage.<anonymous closure> (package:dart_cassandra_cql/driver/connection/connection.dart:237:26)
#8 _RootZone.runUnary (dart:async/zone.dart:1155)
#9 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:484)
#10 _Future._propagateToListeners (dart:async/future_impl.dart:567)
#11 _Future._completeWithValue (dart:async/future_impl.dart:358)
#12 _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:412)
#13 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#14 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#15 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#16 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
#0 _rootHandleUncaughtError.<anonymous closure> (dart:async/zone.dart:886)
#1 _asyncRunCallbackLoop (dart:async/schedule_microtask.dart:41)
#2 _asyncRunCallback (dart:async/schedule_microtask.dart:48)
#3 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:84)
#4 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:131)
My code (Windows 7, Dart 1.8, Cassandra 2.1.2):
====================
main:
====================
void initCassandra(){
List<String> queries = new List<String>();
queries.add(common_dao.createSimpleKeyspaceQuery("bi"));
queries.add(user_dao.getCreateTableQuery());
cassandra.synchronizedQuery(queries);
}
void main() {
initCassandra();
HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 8080).then((server) {
var router = new Router(server)
....
});
}
========================
cassandra.dart:
========================
library cassandra;
import 'dart:async';
import 'package:dart_cassandra_cql/dart_cassandra_cql.dart' as cql;
void synchronizedQuery(List<String>queries){
cql.Client client = new cql.Client.fromHostList(['localhost']);
if(queries.isEmpty){
return;
}
print("synchronizedQuery: query[0]: "+queries[0]);
Future<cql.ResultMessage> f = client.execute(new cql.Query(queries[0]))
.catchError((e){print("synchronizedQuery: Error: "+e.toString());});
int i=1;
while(i<queries.length){
String q = queries[i];
f.then((_){client.execute(new cql.Query(q));});
i++;
}
}
Something is it wrong ?
Thanks very much
Christophe
Hi, as i have checked python driver, and its well maintained and updated, Thus; is this driver our of date? is it maintained?
Hey Man !!
Can you please give an example of stream using streambuilder.
Appreciate if you reply ๐
While working #2 I noticed that library's code is not formatted with dartfmt
.
I use Atom with Dart plugin and it formats files automatically on safe, which is super convenient since I don't have to worry about formatting and code style is guaranteed to be consistent throughout the project.
Would you be opposed to running dartfmt
on all project files (in lib/
and test/
)? This would simplify work on future PRs, as well as other benefits mentioned above.
Of course, I can submit a PR for this, if you're interested.
Hey,
Just curious if there is anything similar to "Token aware" client policy in Java driver? (docs: https://docs.datastax.com/en/latest-java-driver/common/drivers/reference/tuningPolicies_c.html )
It seems that this should be configurable in connection pool, but I couldn't find anything just looking at the docs.
UPDATE:
NodeJS driver seems to support this as well
http://datastax.github.io/nodejs-driver/features/tuning-policies/#load-balancing-policy
https://github.com/datastax/nodejs-driver/blob/master/lib/policies/load-balancing.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.