Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming protocols #10

Merged
merged 44 commits into from
Oct 29, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
079c31a
Major rewrite.
Oct 10, 2015
a509a8d
Remove factory concept.
Oct 10, 2015
3551c92
Park other projects until core stabilises.
Oct 10, 2015
7677fa5
Add server side channels and protocols.
Oct 11, 2015
c92fe74
Multiplex service/protocol combinations in a single application channel.
Oct 11, 2015
9589a39
Updated default server protocol
Oct 11, 2015
327c6a3
INtro the concept of the server stack.
Oct 11, 2015
1697b62
Beginning of end to end tests.
Oct 11, 2015
f0e5ad1
Ensure outgoing proto is always set to 'event' in the event client pr…
Oct 12, 2015
ac7c6c6
RRP handler registration and selection.
Oct 14, 2015
0b4fd3f
RRP Server API
Oct 14, 2015
a14fe94
End to end working request/response over channels
Oct 14, 2015
2f3577b
Re-introduce Codecs, locked to JSON in first iteration.
Oct 14, 2015
5cd0c14
Rework amqp transport, making space for an amqp 1.0 listener/ connect…
Oct 16, 2015
55dfb33
AMQP channel handshake.
Oct 16, 2015
1a569ac
Bring intoline withfully working RRP.
Oct 22, 2015
57ca576
More rrp fixes, extended testing using an external broker.
Oct 23, 2015
437c459
Add event type param
Oct 23, 2015
1efa949
Update with transport event consturctor update.
Oct 23, 2015
e411c99
Update with transport event consturctor update.
Oct 23, 2015
6cc2e24
Working RRP.
Oct 23, 2015
b3ca3f1
Working RRP.
Oct 23, 2015
8793ef3
Fix regression caused by full introduction of source/target
Oct 25, 2015
f72dadb
Clean shutdown of AMQP transport.
Oct 25, 2015
c614077
Client side 'event' protocol implementation.
Oct 25, 2015
c508e2d
Consistent naming.
Oct 25, 2015
e033c07
Add service advertising.
Oct 26, 2015
08bee3b
Simpler RRP api frontend.
Oct 26, 2015
9b917f0
Introduce HandlerPredicates for commonly used predicate creation.
Oct 26, 2015
912673f
Rework handleRequestr API to work more nicely in groovy wi closures.
Oct 27, 2015
0d58b4a
InMem transport.
Oct 28, 2015
d059e5d
Migrate around a little.
Oct 28, 2015
e790f54
AES payload encryption.
Oct 28, 2015
03e0837
AES payload encryption.
Oct 28, 2015
53d2e1a
Improve codec handling to ensure there is no hardcoding
Oct 28, 2015
4126dc2
Ensure to use remote available codecs for picking best encoding.
Oct 28, 2015
6231b9c
Test helpder needs to behere too.
Oct 28, 2015
caf7383
Test helpder needs to behere too.
Oct 28, 2015
fb4f2f7
Test helpder needs to behere too.
Oct 28, 2015
1c70e12
Ignore if on teamcity. Requires an external broker, so can't run as …
Oct 28, 2015
fd44437
Fold inmem transport into core to enable simulation style and full st…
Oct 28, 2015
d6d2d3f
Fold inmem transport into core to enable simulation style and full st…
Oct 28, 2015
f03db56
Introspection server
Oct 29, 2015
2bd5073
Introspection client side and full stack simulation.
Oct 29, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 50 additions & 60 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ buildscript {
def globalVersion = new Version(currentVersion)
def hasbintray = hasProperty("bintrayUsername")

//compileJava {
// sourceCompatibility = 1.7
// targetCompatibility = 1.7
//}
//
//compileTestJava {
// sourceCompatibility = 1.7
// targetCompatibility = 1.7
//}

ext {
gradleVersion = '2.4'

Expand All @@ -43,6 +33,7 @@ subprojects { subproject ->
dependencies {
compile "org.codehaus.groovy:groovy-all:2.4.1"
testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
testCompile 'cglib:cglib:2.2.2'
}

compileJava {
Expand Down Expand Up @@ -110,68 +101,67 @@ project('muon-core') {

//Gson codec (the default)
compile 'com.google.code.gson:gson:2.3.1'
testCompile "org.spockframework:spock-core:1.0-groovy-2.3"
testCompile "io.projectreactor:reactor-stream:$reactorVersion"
testCompile 'org.slf4j:slf4j-jdk14:1.7.12'
}
}

project('muon-tck') {
apply plugin: 'application'

description = 'Muon TCK Implementation for testing the validity of this Muon library'

mainClassName = "com.simplicity.services.TCKService"

repositories {
maven { url 'http://repo.spring.io/libs-milestone' }
}
dependencies {
compile project(":muon-core")
compile project(":muon-transport-amqp")
compile project(":muon-discovery-amqp")
compile project(":muon-codec-kryo")
compile "io.projectreactor:reactor-stream:$reactorVersion"
compile 'org.slf4j:slf4j-jdk14:1.7.12'
}
}

//project('muon-tck') {
// apply plugin: 'application'
//
// description = 'Muon TCK Implementation for testing the validity of this Muon library'
//
// mainClassName = "com.simplicity.services.TCKService"
//
// repositories {
// maven { url 'http://repo.spring.io/libs-milestone' }
// }
// dependencies {
// compile project(":muon-core")
// compile project(":muon-transport-amqp")
// compile project(":muon-discovery-amqp")
// compile project(":muon-codec-kryo")
// compile "io.projectreactor:reactor-stream:$reactorVersion"
// compile 'org.slf4j:slf4j-jdk14:1.7.12'
// }
//}
//
project('muon-transport-amqp') {
description = 'Core Muon for Java'
dependencies {
compile project(":muon-core")
compile "com.rabbitmq:amqp-client:3.3.2"
}
}

project('muon-discovery-amqp') {
description = 'A discovery system running on AMQP'
dependencies {
compile project(":muon-transport-amqp")
}
}

project('muon-codec-kryo') {
description = 'Codec implementation using Kryo (for communication with other JVMs only)'
dependencies {
compile project(":muon-core")
compile 'com.esotericsoftware:kryo-shaded:3.0.0'
}
}

project('muon-spring') {
description = 'Spring integration for Muon'
dependencies {
compile project(":muon-core")
compile("io.projectreactor:reactor-stream:$reactorVersion")
compile('org.springframework:spring-context:4.1.6.RELEASE')
testCompile('junit:junit:4.12')
testCompile('org.mockito:mockito-core:1.10.19')
//TODO remove these when MuonBuilder hardcoded forClass is removed
testCompile project(":muon-transport-amqp")
testCompile project(":muon-discovery-amqp")
}
}
//
//project('muon-discovery-amqp') {
// description = 'A discovery system running on AMQP'
// dependencies {
// compile project(":muon-transport-amqp")
// }
//}
//
//project('muon-codec-kryo') {
// description = 'Codec implementation using Kryo (for communication with other JVMs only)'
// dependencies {
// compile project(":muon-core")
// compile 'com.esotericsoftware:kryo-shaded:3.0.0'
// }
//}
//
//project('muon-spring') {
// description = 'Spring integration for Muon'
// dependencies {
// compile project(":muon-core")
// compile("io.projectreactor:reactor-stream:$reactorVersion")
// compile('org.springframework:spring-context:4.1.6.RELEASE')
// testCompile('junit:junit:4.12')
// testCompile('org.mockito:mockito-core:1.10.19')
// //TODO remove these when MuonBuilder hardcoded forClass is removed
// testCompile project(":muon-transport-amqp")
// testCompile project(":muon-discovery-amqp")
// }
//}

task wrapper(type: Wrapper) {
gradleVersion = '2.5'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package io.muoncore.codec;
package io.muoncore.crud.codec;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.util.Map;

public class KryoBinaryCodec implements BinaryCodec {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package io.muoncore.codec;
package io.muoncore.crud.codec;

import io.muoncore.MuonExtension;
import io.muoncore.MuonExtensionApi;
import io.muoncore.MuonService;
import io.muoncore.crud.MuonService;

public class KryoExtension implements MuonExtension {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.muoncore.codec
package io.muoncore.crud.codec

import spock.lang.Specification

Expand Down
19 changes: 17 additions & 2 deletions muon-core/src/main/java/io/muoncore/Discovery.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@

import java.net.URI;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public interface Discovery {
/**
* Lookup a remote service via the muon:// url scheme
* Lookup a remote service in the cache via the muon:// url scheme
*/
ServiceDescriptor getService(URI uri);
default Optional<ServiceDescriptor> getService(URI uri) {
if (!uri.getScheme().equals("muon")) {
throw new IllegalArgumentException("Discovery requires muon://XXX scheme urls for lookup");
}
return findService(serviceDescriptor -> uri.getHost().equals(serviceDescriptor.getIdentifier()));
}

/**
* Lookup a remote service in the cache via some predicate
*/
default Optional<ServiceDescriptor> findService(Predicate<ServiceDescriptor> predicate) {
return getKnownServices().stream().filter(predicate).findFirst();
}

/**
* Return all of the services that are currently visible by this discovery mechanism
Expand Down
5 changes: 5 additions & 0 deletions muon-core/src/main/java/io/muoncore/DiscoverySource.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package io.muoncore;

public interface DiscoverySource {
Discovery getDiscovery();
}
Loading