我想知道Reactive Programming如何与Functional-Programming联系起来.
大多数论文将"反应式编程"称为"功能反应式编程".
反应式编程是否可以在功能编程之外实现?
用功能语言编写反应式程序更容易吗?
java paradigms functional-programming scala reactive-programming
com.mongodb.client.model.geojson.Polygon
我正在尝试使用 MongoDB 的类和类进行地理空间查询com.mongodb.client.model.geojson.Position
。客户端代码在其自己的boundingBox对象中填充四个双角。
这是代码片段:
Polygon polygon = new Polygon(Arrays.asList(new Position(boundingBox.getRightLongitude(),boundingBox.getTopLatitude()),
new Position(boundingBox.getLeftLongitude(), boundingBox.getTopLatitude()),
new Position(boundingBox.getLeftLongitude(), boundingBox.getBottomLatitude()),
new Position(boundingBox.getRightLongitude(), boundingBox.getBottomLatitude()),
new Position(boundingBox.getRightLongitude(), boundingBox.getTopLatitude())));
//Document filter = new Document("coordinates",geoWithin("coordinates", polygon));
Block<Document> printBlock = new Block<Document>() {
@Override
public void apply(final Document document) {
System.out.println(document.toJson());
}
};
database.getCollection("roads").find(geoWithin("coordinates",polygon)).forEach(printBlock);
Run Code Online (Sandbox Code Playgroud)
这是错误:
Exception in thread "main" org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class com.mongodb.client.model.geojson.Polygon.
Run Code Online (Sandbox Code Playgroud) 我想了解是否可以使用非功能语言实现反应性应用程序宣言背后的原则.
有人说,由于FP使用不可变状态和自由副作用函数,因此它们更容易实现并发,分布式和弹性系统.
但是我们如何使用Java实现这一目标呢?
有一些像Apache Camel这样的框架,有一些可以使用的组件,比如Camel RX和Camel SEDA.
这些框架是否足够?
我会尽力澄清我的问题:
我认为反应式编程是新的编程范式,而新的编程范式需要新的工具和框架.
功能语言以不同的方式处理对象,这就是为什么有很多关于FRP使用基于事件和异步的事情的文章.
但现在,支持Java或其他面向对象的语言,让我们在Web应用程序中思考:
我知道可以创建一个使用java,servlet和EJB来完成这些需求的应用程序,但我的问题是,我们可以采用不同的方式吗?更接近被动方法?
我想是这样的:
你认为这是一个好方法吗?
java functional-programming apache-camel reactive-programming
我无法通过eclipse构建项目,但是当我运行mvn clean install时它工作正常.我收到了以下问题.
Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project abc-xxx: Execution default-
install of goal org.apache.maven.plugins:maven-install-plugin:2.4:install
failed: Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its
dependencies could not be resolved: Failed to collect dependencies at
org.apache.maven.plugins:maven-install-plugin:jar:2.4 ->
org.codehaus.plexus:plexus-utils:jar:3.0.5: Failed to read artifact descriptor
for org.codehaus.plexus:plexus-utils:jar:3.0.5: Could not transfer artifact
org.codehaus.plexus:plexus-utils:pom:3.0.5 from/to anonymous
(https://nexus.xxx.xxx.xxx/nexus/content/groups/xxx):
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
Run Code Online (Sandbox Code Playgroud) java ×4
apache-camel ×1
eclipse ×1
geospatial ×1
maven ×1
mongodb ×1
paradigms ×1
scala ×1
spring ×1