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

Promote Dev to Master #32

Merged
merged 77 commits into from
Feb 21, 2019
Merged
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
c6ad78e
feat (stan test) scenario where multiple brokers start/stop
pentateu Feb 6, 2019
5c18a15
feat (stop cycle) broker, registry and trasit stop lifecycle
pentateu Feb 6, 2019
9105802
feat (registry lock) service and node catalogs lock on Add method
pentateu Feb 7, 2019
9c25880
fix (Node) ipList needs to be always initilized.
pentateu Feb 7, 2019
6fbdecd
fix (travis) nats streaming without channel limit
pentateu Feb 7, 2019
2b54945
feat (payload) payload interface used for transport and params
pentateu Feb 7, 2019
d14491a
feat (payload) return payload on action call
pentateu Feb 7, 2019
b35a223
feat (Payload) payload as params and return of action requests
pentateu Feb 8, 2019
cfd0c00
feat (payload) add Array convinience methods
pentateu Feb 8, 2019
4840e4e
feat (error h) handle action errors.
pentateu Feb 8, 2019
ffde1a4
test(payload) test for all list types
pentateu Feb 8, 2019
5a56752
chore (serializer) renamed methods with Message to Payload
pentateu Feb 8, 2019
e955779
test(payload) diferent array and map sources
pentateu Feb 9, 2019
8c77e6f
test(transformers) add more tests to cover all cases
pentateu Feb 9, 2019
7989bb7
test(payload) cover more scenarios
pentateu Feb 9, 2019
ee667f5
test(serialier) test nil conditions.
pentateu Feb 9, 2019
b73f75f
chore(travis) trying coveralls setup
pentateu Feb 9, 2019
723d648
fix (payload) test with mixed results now is stable
pentateu Feb 9, 2019
627e920
Merge pull request #27 from moleculer-go/feature/paramsErrorHandling
pentateu Feb 9, 2019
d8f80e2
chore (context) renamed RemoteActionContext to RemoteContext
pentateu Feb 8, 2019
95fb947
feat (version) check protocol version on arriving msg and add version…
pentateu Feb 8, 2019
4c2faf6
WIP Events
pentateu Feb 8, 2019
582fdf4
feat (event) load balance
pentateu Feb 9, 2019
b0181a0
feat (emit) basic emit event flow and test
pentateu Feb 9, 2019
5c9e3d9
merge
pentateu Feb 9, 2019
fdd2e43
fix (strategy) adjust test with nre API
pentateu Feb 9, 2019
a225ca5
feat (event) emit local event and handle remote events
pentateu Feb 9, 2019
d7707b2
bench(events) benchmark events tests and fixed concurrency issues.
pentateu Feb 10, 2019
016f2b3
feat(broadcast) broadcast events locally and remote.
pentateu Feb 12, 2019
53f3dea
feat(broadcast) broadcast events locally and remote.
pentateu Feb 12, 2019
1ca205b
chore (cover) remove cover files
pentateu Feb 13, 2019
1a0a288
fix (coverage) change travis to use ginkgo and fixed endless loops :)
pentateu Feb 13, 2019
a88f945
Merge branch 'feature/events' of github.com:moleculer-go/moleculer in…
pentateu Feb 13, 2019
5c7002f
chore (travis) add cover params to test run
pentateu Feb 13, 2019
ed0f98c
feat(midlewares) CallHandlers and basic midleware flow.
pentateu Feb 13, 2019
e112657
Merge pull request #28 from moleculer-go/feature/events
pentateu Feb 13, 2019
fe9291a
Merge pull request #29 from moleculer-go/feature/middlewares
pentateu Feb 13, 2019
8f79c79
feat (travis) add gover to bundle coverage reports.
pentateu Feb 17, 2019
b0cd822
feat (drone.io) added drone.yml to test drone.io CI
pentateu Feb 18, 2019
c6d9994
chore(drone) trying to get build sorted
pentateu Feb 18, 2019
32d3344
again ...
pentateu Feb 18, 2019
ae510a5
once more ...
pentateu Feb 18, 2019
78e48ca
feat (metrics) add flag to context
pentateu Feb 13, 2019
dd520d1
feat (broker) calling middlewares from config
pentateu Feb 14, 2019
f91e09e
feat (MetricsRate) config and use of MetricsRate
pentateu Feb 14, 2019
15ece7f
feat (metrics) measure action processing time and emit metrics events
pentateu Feb 14, 2019
7a9997a
feat (service) start, stoped created lifecycle calls.
pentateu Feb 14, 2019
a268135
feat (MCall) multiple calls convinience method
pentateu Feb 14, 2019
071240d
feat (MCall) multiple calls in one go.
pentateu Feb 14, 2019
5d38750
fix (test) fromSchema calls missing params.
pentateu Feb 14, 2019
dc4ede0
feat ($node) internal node service with list action
pentateu Feb 15, 2019
c0ac673
fix (test) reusable test harness
pentateu Feb 15, 2019
876a9ce
chore (travis) traying to add CodeCov
pentateu Feb 15, 2019
cec0c62
fix (snapshopt) using fixee value for ipList
pentateu Feb 15, 2019
1a05391
chore (broker) improve tests
pentateu Feb 15, 2019
c92d037
chore (travis) adjusted ginkgo params
pentateu Feb 15, 2019
ac6e97e
fix(node) update info pkt with all fields.
pentateu Feb 15, 2019
3220289
feat ($node.list) list nodes from local registry
pentateu Feb 15, 2019
8ef2afb
chore (test) made the test harness generic for other tests.
pentateu Feb 15, 2019
590884d
feat ($node.services) list all services available in the local registry.
pentateu Feb 16, 2019
613e798
feat (RawMap) payload.RawMap()
pentateu Feb 16, 2019
dd6c106
WIP $node.services
pentateu Feb 16, 2019
10bc39f
WIP $node.actions
pentateu Feb 16, 2019
cadba49
chore (travis) added gover to compile all coverage output into a sing…
pentateu Feb 17, 2019
c1c4edf
feat (docker) micro-services stack
pentateu Feb 17, 2019
340ff16
fix (node) local node, available and expired lifecycles.
pentateu Feb 18, 2019
e4089a5
chore rebase
pentateu Feb 18, 2019
7b72b1d
WIP fixing events consistency
pentateu Feb 19, 2019
60395bf
chore scaled bakc broker test to 1 interations
pentateu Feb 19, 2019
6b96217
chore(docker) remove all files as it was conflicting with go get.
pentateu Feb 19, 2019
f3266d3
chore(drone) trying to fix drone io build
pentateu Feb 19, 2019
fa54a36
chore removed debug panic
pentateu Feb 19, 2019
9fa1333
chore drone build...
pentateu Feb 19, 2019
15678ff
chore (drone) fixing build
pentateu Feb 19, 2019
208f6e7
chore broker tests - disabled tets with issue
pentateu Feb 19, 2019
efd0d93
chore (test) remove circular dependencie
pentateu Feb 19, 2019
6bd9435
Merge pull request #31 from moleculer-go/feature/nodeService
pentateu Feb 20, 2019
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
Prev Previous commit
Next Next commit
feat (stop cycle) broker, registry and trasit stop lifecycle
pentateu committed Feb 6, 2019
commit 5c18a15a089bca3536d521fd4ac90551834a1bab
15 changes: 8 additions & 7 deletions broker/broker.go
Original file line number Diff line number Diff line change
@@ -22,13 +22,14 @@ import (
)

var defaultConfig = moleculer.BrokerConfig{
LogLevel: "INFO",
LogFormat: "TEXT",
DiscoverNodeID: DiscoverNodeID,
Transporter: "MEMORY",
HeartbeatFrequency: 5 * time.Second,
HeartbeatTimeout: 30 * time.Second,
OfflineCheckFrequency: 20 * time.Second,
LogLevel: "INFO",
LogFormat: "TEXT",
DiscoverNodeID: DiscoverNodeID,
Transporter: "MEMORY",
HeartbeatFrequency: 5 * time.Second,
HeartbeatTimeout: 30 * time.Second,
OfflineCheckFrequency: 20 * time.Second,
NeighboursCheckTimeout: 2 * time.Second,
}

// DiscoverNodeID - should return the node id for this machine
15 changes: 8 additions & 7 deletions moleculer.go
Original file line number Diff line number Diff line change
@@ -63,13 +63,14 @@ type Mixin struct {
}

type BrokerConfig struct {
LogLevel string
LogFormat string
DiscoverNodeID func() string
Transporter string
HeartbeatFrequency time.Duration
HeartbeatTimeout time.Duration
OfflineCheckFrequency time.Duration
LogLevel string
LogFormat string
DiscoverNodeID func() string
Transporter string
HeartbeatFrequency time.Duration
HeartbeatTimeout time.Duration
OfflineCheckFrequency time.Duration
NeighboursCheckTimeout time.Duration
}

type ActionHandler func(context Context, params Params) interface{}
2 changes: 2 additions & 0 deletions registry/registry.go
Original file line number Diff line number Diff line change
@@ -100,6 +100,8 @@ func (registry *ServiceRegistry) Stop() {
registry.logger.Debug("Registry Stop() ")
registry.stoping = true
<-registry.transit.Disconnect()
registry.logger.Debug("Transit Disconnected -> Registry Full Stop!")

}

// Start : start the registry background processes.
15 changes: 13 additions & 2 deletions transit/nats/stan.go
Original file line number Diff line number Diff line change
@@ -67,10 +67,21 @@ func (transporter *StanTransporter) Connect() chan bool {
func (transporter *StanTransporter) Disconnect() chan bool {
endChan := make(chan bool)
go func() {
transporter.logger.Debug("Disconnect() # of subscriptions: ", len(transporter.subscriptions))
for _, sub := range transporter.subscriptions {
sub.Unsubscribe()
error := sub.Unsubscribe()
if error != nil {
transporter.logger.Error("Disconnect() error when unsubscribing stan subscription: ", error)
}
}
transporter.connection.Close()
transporter.logger.Debug("Disconnect() subscriptions unsubscribed.")
error := transporter.connection.Close()
if error == nil {
transporter.logger.Debug("Disconnect() stan connection closed :)")
} else {
transporter.logger.Error("Disconnect() error when closing stan connection :( ", error)
}

transporter.connection = nil
endChan <- true
}()
12 changes: 8 additions & 4 deletions transit/nats/stan_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package nats_test

import (
"fmt"

"github.com/moleculer-go/moleculer/util"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -102,25 +104,25 @@ var _ = Describe("Transit", func() {
}

It("Should create multiple brokers, connect and disconnect and make sure stan resources are closed/released properly.", func() {

logLevel := "DEBUG"
brokersLoop := 100
for i := 0; i < brokersLoop; i++ {
brokr1 := broker.FromConfig(&moleculer.BrokerConfig{
LogLevel: "INFO",
LogLevel: logLevel,
Transporter: "STAN",
})
addUserService(brokr1)
brokr1.Start()

brokr2 := broker.FromConfig(&moleculer.BrokerConfig{
LogLevel: "INFO",
LogLevel: logLevel,
Transporter: "STAN",
})
addContactService(brokr2)
brokr2.Start()

brokr3 := broker.FromConfig(&moleculer.BrokerConfig{
LogLevel: "INFO",
LogLevel: logLevel,
Transporter: "STAN",
})
addProfileService(brokr3)
@@ -131,6 +133,8 @@ var _ = Describe("Transit", func() {
Expect(len(newList)).Should(Equal(arraySize + 6))

stopBrokers(brokr1, brokr2, brokr3)

fmt.Println("**** One More Loop -> Total: ", i)
}

})
9 changes: 4 additions & 5 deletions transit/pubsub/pubsub.go
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ func Create(broker moleculer.BrokerDelegates) transit.Transit {
pendingRequests: pendingRequests,
logger: broker.Logger("Transit", ""),
serializer: serializer.FromConfig(broker),
neighboursTimeout: 1 * time.Second,
neighboursTimeout: broker.Config.NeighboursCheckTimeout,
knownNeighbours: knownNeighbours,
neighboursMutex: &sync.Mutex{},
pendingRequestsMutex: &sync.Mutex{},
@@ -150,7 +150,7 @@ func (pubsub *PubSub) waitForNeighbours() bool {
expected := pubsub.expectedNeighbours()
neighbours := pubsub.neighbours()
if expected <= neighbours && expected > 0 && neighbours > 0 {
pubsub.logger.Info("waitForNeighbours() - received INDO from all expected neighbours: ", expected)
pubsub.logger.Info("waitForNeighbours() - received info from all expected neighbours :) -> expected: ", expected)
return true
}
if time.Since(start) > pubsub.neighboursTimeout {
@@ -395,9 +395,8 @@ func (pubsub *PubSub) Disconnect() chan bool {
}
pubsub.logger.Info("PubSub - Disconnecting transport...")
pubsub.sendDisconnect()
endChan = pubsub.transport.Disconnect()
pubsub.isConnected = false
return endChan
return pubsub.transport.Disconnect()
}

// Connect : connect the transit with the transporter, subscribe to all events and start publishing its node info
@@ -411,7 +410,7 @@ func (pubsub *PubSub) Connect() chan bool {
pubsub.transport = pubsub.createTransport(pubsub.broker)
go func() {
pubsub.isConnected = <-pubsub.transport.Connect()
pubsub.logger.Debug("Transport Connected!")
pubsub.logger.Debug("PubSub - Transport Connected!")
if pubsub.isConnected {
pubsub.subscribe()
}