Commit Graph

279 Commits

Author SHA1 Message Date
Spencer Gibb
40e048c820 Make sure InetUtils.executorService shuts down.
See https://github.com/spring-cloud/spring-cloud-netflix/issues/491
2016-01-19 14:33:28 -07:00
Dave Syer
df6203a204 Fix ordering problem with tests
EnableDiscoveryClientMissingImplTests did not close its application
context, so it caused other tests to fail on the command line
(sometimes).
2016-01-18 18:05:26 +00:00
Dave Syer
47c77cb165 Fix discovery client if enabled but no impl available
If user has @EnableDiscoveryClient but no implementation (e.g. if he
just has @EnableZuulProxy) the autoconfig will now kick in and
provide an instance of NoopDiscoveryClient.

Fixes gh-80
2016-01-18 18:04:06 +00:00
Spencer Gibb
457d237ad0 Merge pull request #76 from olivergierke/hypermedia
Added hypermedia support in the form of a DiscoveredResource abstraction
2016-01-13 15:05:53 -07:00
Oliver Gierke
526b338c36 Added hypermedia support in the form of a RemoteResource abstraction.
This commit introduces support to easily discover resources in remote
service APIs and periodically validating they're still available.

The core concept is a RemoteResource and its primary implementation
DiscoveredResource which consists of a ServiceInstanceProvider and a
TraversalDescription. The service instance provider abstracts the location
of the service the DiscoveredResource is hosted at. Currently there are
two implementations available: a StaticServiceInstanceProvider that — as
the name suggests — returns a statically configured instance, as well as
the DynamicServiceInstanceProvider which takes a DiscoveryClient and service
name as input to dynamically discover the ServiceInstance on request.

The TraversalDefinition is a SAM type that allows to define the path traversals
that shall be executed to discover the target resource within the service
instance. This allows the following configuration:

DiscoveryClient client = …
ServiceInstanceProvider provider = new DynamicServiceInstanceProvider(client, "stores");
RemoteResource resource = new DiscoveredResource(provider, traverson -> traverson.follow("stores", "search", "by-location");

This will cause the following to happen:

1. In this default state the resource is undiscovered and calls to getLink()
   will return null.
2. A call to verifyOrDiscover() will trigger resource discovery, i.e. lookup
   the service instance using the discovery client, execute the path traversal
   as defined and store the final link discovered ("by-location") in the
   discovered resource.
3. Calls to getLink() will return that link. Calls to verifyOrDiscover()
   will issue a HEAD request to verify the resource is still available and
   reset the link if not. Subsequent calls to verifyOrDiscover() will trigger
   rediscovery.

That means that we basically shield against either the service instance becoming
unavailable or the resource becoming unavailable within the service instance
(due to some URI restructuring or the like).

The calls to verifyOrDiscover() are currently automated by a RemoteResourceRefresher
which is auto-configured if a RemoteResource is declared as Spring bean
and its initial and fixed delay can be configured via properties in the
spring.cloud.hypermedia namespace.
2016-01-13 19:58:33 +01:00
Dave Syer
cbfd48d5fa Make thread pool static and provide convenience wrappers
Existing usages of the static methods should still work, and all
usage is on a single background thread.

Fixes gh-77
2016-01-12 16:23:43 +00:00
Dave Syer
168bd6c77d Add spring profiles for repos 2016-01-08 13:15:04 +00:00
Dave Syer
a44f9b72bb Remove duplicate repo declarations 2016-01-08 12:26:50 +00:00
Dave Syer
55bdda9cb1 Don't clobber rest template interceptors 2016-01-08 12:05:45 +00:00
Dave Syer
cd7fbd617d Add separate dependencies module 2016-01-08 12:05:13 +00:00
Dave Syer
14d54b1964 Eagerly instantiate @RefreshScope beans on startup
This ensures that any fetaures that require a bean to be instantiated
(for instance @Scheduled) behave the same for @RefreshScope and normal
singletons.

Fixes gh-74
2015-12-31 15:30:30 +00:00
Dave Syer
162fb70349 Change log level to trace in InetUtils 2015-12-31 10:52:21 +00:00
Dave Syer
26871830f5 Add some docs for config properties 2015-12-30 15:06:07 +00:00
Spencer Gibb
8983309b48 Fix bonehead mistake.
That'll show me for trying to code right before the holidays.

Not only was the auto-config in the WRONG package, I forgot to enable it in autoconfiguration!

fixes gh-bonehead
2015-12-22 17:51:25 -07:00
Spencer Gibb
0d35d3f322 Document ignoring network interfaces. 2015-12-22 17:10:09 -07:00
Spencer Gibb
a42e8eaab5 Allow configurable ignoring of network interfaces.
fixes gh-67
2015-12-22 17:01:52 -07:00
Spencer Gibb
aa2ddce31e Merge pull request #56 from jmnarloch/discovery-metadata
* discovery-metadata:
  Introduced ServiceInstance metadata map.
2015-12-22 14:44:27 -07:00
Jakub Narloch
f9cffe9f3c Introduced ServiceInstance metadata map. 2015-12-22 14:41:03 -07:00
Dave Syer
aaa7288bae Synchronize access to the ObjectFactory in GenericScope
Otherwise multiple instances of a scoped target can be created
if several threads need one at the same time. This isn't always
going to be a problem, but it breaks the singleton semantics, and
might lead to surprising results and/or performance issues if bean
creation is expensive.
2015-12-21 15:45:31 +00:00
Dave Syer
79b11df61f Take care with order of property sources in /refresh endpoint
It's kind of a corner case, but not a very small corner: if a /refresh
leads to a change in a key that was overridden from its default value (e.g.
n a profile-specific config file) then the key is not identified as changed.
The change is still applied.

This commit fixes the key computation and adds a couple of tests.

Fixes gh-73
2015-12-21 14:32:33 +00:00
Dave Syer
18b29ba35b Revert to snapshot 2015-12-18 15:52:36 +00:00
Dave Syer
cb25fa2166 Update to 1.1.0.M4 2015-12-18 15:50:30 +00:00
Dave Syer
016224287f Re-order autoconfig: refresh scope can be used without actuator 2015-12-18 14:59:47 +00:00
Dave Syer
25f7ea215d Ensure InetUtils uses a non-daemon thread 2015-12-18 11:28:52 +00:00
Dave Syer
af26af4bfa Merge branch '1.0.x'
Fixes for gh-70
2015-12-18 10:07:18 +00:00
Dave Syer
5e29312518 Reverse order of property sources before decrypting
Fixes gh-70
2015-12-18 10:04:27 +00:00
Dave Syer
99cd797464 Reverse order of property sources before decrypting
Fixes gh-70
2015-12-18 09:48:14 +00:00
Spencer Gibb
7d86198b17 Migrate SpringClientFactory and FeignClientFactory functions
fixes gh-69
2015-12-17 14:25:15 -07:00
Spencer Gibb
78e4786aa9 Merge pull request #68 from snicoll/fix-doc
* fix-doc:
  Polish doc
2015-12-17 10:07:12 -07:00
Stephane Nicoll
933d1abcdd Polish doc 2015-12-17 10:06:52 -07:00
Dave Syer
eb67c2fe5a Fix error in plaveholder for timeout 2015-12-08 16:28:12 +00:00
Dave Syer
e9b9897aba Add timeout (default 1sec) to hostname lookup
User can set spring.util.timeout.sec (or env var equivalent with
CAP_CASE).

Fixes gh-55
2015-12-08 14:47:10 +00:00
Dave Syer
c2b473adb0 Reverts 5d7f18f so that shutdown hook is owned by main context
Fixes gh-62, fixes gh-63
2015-12-04 14:11:47 +00:00
Dave Syer
96ec2d32ea Switch of shutdown hook in bootstrap
Fixes gh-61
2015-12-02 17:07:26 +00:00
Dave Syer
fcc1249827 Ensure info endpoint is available when condition is evaluated 2015-11-17 11:58:56 +00:00
Dave Syer
346e513bcb Revert to snapshots 2015-11-17 09:52:52 +00:00
Dave Syer
a0e95019f0 Update to 1.1.0.M3 2015-11-17 09:47:41 +00:00
Spencer Gibb
12dd15682d Bumped to 1.0.4.BUILD-SNAPSHOT 2015-11-16 10:01:29 -07:00
Dave Syer
9e1d83020d Allow multiple rest template customizers 2015-11-12 16:22:29 +00:00
Dave Syer
988189db82 Add extra decryption step before propery source locators
See also the integration tests in spring-cloud-samples/tests

Fixes gh-58
2015-11-11 09:13:56 +00:00
Dave Syer
7f2f008300 Compiler warnings 2015-11-02 15:04:48 +00:00
Dave Syer
5d40088b7e Class name change in Spring Boot 2015-10-31 15:34:23 +00:00
Dave Syer
b1fa9cba4b Revert profile and add comment 2015-10-20 09:34:47 -04:00
Dave Syer
6703ff0594 Remove confusing profile from settings.xml 2015-10-20 09:27:59 -04:00
Dave Syer
a6124e7063 Add another property source for decrypted bootstrap properties
The problem is that we do want bootstrap properties to override
default properties in most cases, but if they are decrypted those
values have to be added with the highest possible precedence.

Fixes gh-54
2015-10-02 15:00:22 +01:00
Dave Syer
41f0b641dd Add int converter to inet utils 2015-09-28 10:42:49 +01:00
Spencer Gibb
0bb2f48e4c Only lookup abstract features from context. 2015-09-25 16:00:58 -06:00
Spencer Gibb
be1c4ae881 Convenience methods on HasFeature 2015-09-25 14:43:15 -06:00
Spencer Gibb
93455532f9 Features actuator endpoint
Allows modules to declare features and display if they enabled or not.
2015-09-25 14:12:59 -06:00
Spencer Gibb
a582e4e1bf Calculate the default instance id. 2015-09-24 17:11:14 -06:00