Example #1
0
func (watcher *Watcher) emitMessages(logger lager.Logger, messagesToEmit routing_table.MessagesToEmit) {
	if watcher.emitter != nil {
		logger.Debug("emitting-messages", lager.Data{"messages": messagesToEmit})
		watcher.emitter.Emit(messagesToEmit)
		routesRegistered.Add(messagesToEmit.RouteRegistrationCount())
		routesUnregistered.Add(messagesToEmit.RouteUnregistrationCount())
	}
}
package routing_table_test

import (
	"github.com/cloudfoundry-incubator/route-emitter/routing_table"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("MessagesToEmit", func() {
	var (
		messagesToEmit routing_table.MessagesToEmit
		messages1      []routing_table.RegistryMessage
	)

	BeforeEach(func() {
		messagesToEmit = routing_table.MessagesToEmit{}
		messages1 = []routing_table.RegistryMessage{
			{
				Host: "1.1.1.1",
				Port: 61000,
				App:  "log-guid-2",
				URIs: []string{"host1.example.com"},
			},
			{
				Host: "1.1.1.1",
				Port: 61001,
				App:  "log-guid-1",
				URIs: []string{"host1.example.com"},
			},
			{