Why eureka considers a service still 'UP' even if its last renewal time was two days ago - spring-cloud

I have a service with 2 replicas running. But I found the service having 3 UP instances in eureka's dashboard.
Below the detail info of the service in eureka. The problematic instance is 8d0c39f3ed9b:ocr-server:8095, whose last renewal time was two days ago. And the status and health url can NOT be accessed. I'm wondering why eureka considers it's UP!
<application>
<name>OCR-SERVER</name>
<instance>
<instanceId>211a4634b45f:ocr-server:8095</instanceId>
<hostName>211a4634b45f</hostName>
<app>OCR-SERVER</app>
<ipAddr>10.0.0.38</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8095</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1505589414444</registrationTimestamp>
<lastRenewalTimestamp>1505833520772</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1505589414444</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://211a4634b45f:8095/</homePageUrl>
<statusPageUrl>http://211a4634b45f:8096/manage/info</statusPageUrl>
<healthCheckUrl>http://211a4634b45f:8096/manage/health</healthCheckUrl>
<vipAddress>ocr-server</vipAddress>
<secureVipAddress>ocr-server</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1505589414444</lastUpdatedTimestamp>
<lastDirtyTimestamp>1505589412731</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
<instance>
<instanceId>8d0c39f3ed9b:ocr-server:8095</instanceId>
<hostName>8d0c39f3ed9b</hostName>
<app>OCR-SERVER</app>
<ipAddr>10.0.0.38</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8095</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1505589356797</registrationTimestamp>
<lastRenewalTimestamp>1505589356797</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1505589356797</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://8d0c39f3ed9b:8095/</homePageUrl>
<statusPageUrl>http://8d0c39f3ed9b:8096/manage/info</statusPageUrl>
<healthCheckUrl>http://8d0c39f3ed9b:8096/manage/health</healthCheckUrl>
<vipAddress>ocr-server</vipAddress>
<secureVipAddress>ocr-server</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1505589356797</lastUpdatedTimestamp>
<lastDirtyTimestamp>1505589356787</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
<instance>
<instanceId>0c62739f5ca8:ocr-server:8095</instanceId>
<hostName>0c62739f5ca8</hostName>
<app>OCR-SERVER</app>
<ipAddr>10.0.0.34</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">8095</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1505589403150</registrationTimestamp>
<lastRenewalTimestamp>1505833509700</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1505589403150</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://0c62739f5ca8:8095/</homePageUrl>
<statusPageUrl>http://0c62739f5ca8:8096/manage/info</statusPageUrl>
<healthCheckUrl>http://0c62739f5ca8:8096/manage/health</healthCheckUrl>
<vipAddress>ocr-server</vipAddress>
<secureVipAddress>ocr-server</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1505589403150</lastUpdatedTimestamp>
<lastDirtyTimestamp>1505589400020</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
The config of eureka client looks like below,
eureka:
instance:
statusPageUrlPath: /info
healthCheckUrlPath: /health
preferIpAddress: false
client:
fetchRegistry: true
registryFetchIntervalSeconds: 5
healthcheck:
enabled: true
serviceUrl:
defaultZone: http://eureka-peer1:8761/eureka,http://eureka-peer2:8761/eureka
The configuration of eureka server is,
eureka:
instance:
preferIpAddress: true
enableSelfPreservation: false
homePageUrl: http://${eureka.hostname}/
---
spring:
profiles: peer1
eureka:
instance:
hostname: eureka-peer1
client:
serviceUrl:
defaultZone: http://eureka-peer2:${server.port}/eureka/
---
spring:
profiles: peer2
eureka:
instance:
hostname: eureka-peer2
client:
serviceUrl:
defaultZone: http://eureka-peer1:${server.port}/eureka/
And both the eureka clients and servers are running in docker swarm.

Your server has probably entered the self preservation mode, that's why you see a stale instance there.
I see you have the enableSelfPreservation: false option however it is not in the right section, it should be eureka.server.enableSelfPreservation, your entry is under eureka.instance.enableSelfPreservation which is not right.

Related

How to retract a message in ejabberd?

I'm creating a MUC client and I want to implement some kind of message deletion in the client. I read that deleting an individual message from ejabberd is not possible yet. But how can I use XEP-0424 for the achieve a similar purpose? I've read, written and tested the use case described in that XEP, but no success.
The client send a message like this:
<message xmlns="jabber:client" to="myroom#conference.localhost" type="groupchat">
<body>9</body>
<urls />
<origin-id xmlns="urn:xmpp:sid:0" id="358f5b60-3d10-11ea-be33-5f58c62bedc3" />
</message>
The server broadcasts this:
<message xmlns="jabber:client" to="user1#localhost/1132254315040517635831042" from="myroom#conference.localhost" id="1579690081679918">
<archived xmlns="urn:xmpp:mam:tmp" by="user1#localhost" id="1579690081690608" />
<stanza-id xmlns="urn:xmpp:sid:0" by="user1#localhost" id="1579690081690608" />
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="urn:xmpp:mucsub:nodes:messages">
<item id="1579690081679918">
<message xmlns="jabber:client" xml:lang="en" to="user1#localhost" from="myroom#conference.localhost/user1" type="groupchat">
<archived xmlns="urn:xmpp:mam:tmp" by="myroom#conference.localhost" id="1579690081679918" />
<stanza-id xmlns="urn:xmpp:sid:0" by="myroom#conference.localhost" id="1579690081679918" />
<urls />
<origin-id xmlns="urn:xmpp:sid:0" id="358f5b60-3d10-11ea-be33-5f58c62bedc3" />
<body>9</body>
</message>
</item>
</items>
</event>
</message>
Retraction message sent:
<message xmlns="jabber:client" to="myroom#conference.localhost" type="groupchat">
<apply-to xmlns="urn:xmpp:fasten:0" id="358f5b60-3d10-11ea-be33-5f58c62bedc3">
<retract xmlns="urn:xmpp:message-retract:0" />
</apply-to>
</message>
As result of the retraction message sent, the server broadcasts this:
<message xmlns="jabber:client" to="user1#localhost/1132254315040517635831042" from="myroom#conference.localhost" id="2725765463385791444">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="urn:xmpp:mucsub:nodes:messages">
<item id="2725765463385791444">
<message xmlns="jabber:client" xml:lang="en" to="user1#localhost" from="myroom#conference.localhost/user1" type="groupchat">
<apply-to xmlns="urn:xmpp:fasten:0" id="358f5b60-3d10-11ea-be33-5f58c62bedc3">
<retract xmlns="urn:xmpp:message-retract:0" />
</apply-to>
</message>
</item>
</items>
</event>
</message>
And when I query the history for the room, I receive this:
<message xmlns="jabber:client" to="user1#localhost/395000986606606742032146" from="myroom#conference.localhost">
<result xmlns="urn:xmpp:mam:2" id="1579690081679918">
<forwarded xmlns="urn:xmpp:forward:0">
<message xmlns="jabber:client" xml:lang="en" from="myroom#conference.localhost/user1" type="groupchat">
<x xmlns="http://jabber.org/protocol/muc#user">
<item jid="user1#localhost/1132254315040517635831042" />
</x>
<archived xmlns="urn:xmpp:mam:tmp" by="myroom#conference.localhost" id="1579690081679918" />
<stanza-id xmlns="urn:xmpp:sid:0" by="myroom#conference.localhost" id="1579690081679918" />
<urls />
<origin-id xmlns="urn:xmpp:sid:0" id="358f5b60-3d10-11ea-be33-5f58c62bedc3" />
<body>9</body>
</message>
<delay xmlns="urn:xmpp:delay" from="conference.localhost" stamp="2020-01-22T10:48:01.679918Z" />
</forwarded>
</result>
</message>
What am I missing? Shouldn't I receive something like a tombstone of the message?
So far, my settings are:
ejabberd 19.09.1
Using the MucSub approach
mod_man is configured
Persisting with MySQL 5.7
strophe.js 1.3.4
And this is my ejabberd.yml:
hosts:
- "localhost"
loglevel: 4
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 1
log_rate_limit: 100
certfiles:
- "/etc/letsencrypt/live/localhost/fullchain.pem"
- "/etc/letsencrypt/live/localhost/privkey.pem"
ca_file: "/etc/letsencrypt/live/localhost/cacert.pem"
sql_type: mysql
sql_server: "localhost"
sql_database: "ejabberd"
sql_username: "ejabberd"
sql_password: "****"
sql_port: 3306
auth_method: sql
default_db: sql
listen:
-
port: 5222
ip: "::"
module: ejabberd_c2s
max_stanza_size: 262144
shaper: c2s_shaper
access: c2s
starttls_required: false
-
port: 5269
ip: "::"
module: ejabberd_s2s_in
max_stanza_size: 524288
-
port: 5443
ip: "::"
module: ejabberd_http
tls: true
request_handlers:
"/admin": ejabberd_web_admin
"/api": mod_http_api
"/bosh": mod_bosh
"/captcha": ejabberd_captcha
"/upload": mod_http_upload
### "/ws": ejabberd_http_ws
"/oauth": ejabberd_oauth
-
port: 5280
ip: "::"
module: ejabberd_http
request_handlers:
"/admin": ejabberd_web_admin
"/websocket": ejabberd_http_ws
-
port: 1883
ip: "::"
module: mod_mqtt
backlog: 1000
s2s_use_starttls: optional
acl:
local:
user_regexp: ""
loopback:
ip:
- 127.0.0.0/8
- ::1/128
- ::FFFF:127.0.0.1/128
admin:
user:
- "admin#localhost"
access_rules:
local:
allow: local
c2s:
deny: blocked
allow: all
announce:
allow: admin
configure:
allow: admin
muc_create:
allow: admin
pubsub_createnode:
allow: local
trusted_network:
allow: loopback
api_permissions:
"console commands":
from:
- ejabberd_ctl
who: all
what: "*"
"admin access":
who:
access:
allow:
acl: loopback
acl: admin
oauth:
scope: "ejabberd:admin"
access:
allow:
acl: loopback
acl: admin
what:
- "*"
- "!stop"
- "!start"
"public commands":
who:
ip: 127.0.0.1/8
what:
- status
- connected_users_number
shaper:
normal: 1000
fast: 50000
shaper_rules:
max_user_sessions: 10
max_user_offline_messages:
5000: admin
100: all
c2s_shaper:
none: admin
normal: all
s2s_shaper: fast
max_fsm_queue: 10000
acme:
contact: "mailto:admin#localhost"
ca_url: "https://acme-v01.api.letsencrypt.org"
modules:
mod_adhoc: {}
mod_admin_extra: {}
mod_announce:
access: announce
mod_avatar: {}
mod_blocking: {}
mod_bosh: {}
mod_caps: {}
mod_carboncopy: {}
mod_client_state: {}
mod_configure: {}
mod_disco: {}
mod_fail2ban: {}
mod_http_api: {}
mod_http_upload:
put_url: https://#HOST#:5443/upload
mod_last: {}
mod_mam:
## Mnesia is limited to 2GB, better to use an SQL backend
## For small servers SQLite is a good fit and is very easy
## to configure. Uncomment this when you have SQL configured:
db_type: sql
assume_mam_usage: true
default: always
mod_mqtt: {}
mod_muc:
access:
- allow
access_admin:
- allow: admin
access_create: muc_create
access_persistent: muc_create
access_mam:
- allow
default_room_options:
allow_query_users: false
allow_subscription: true # enable MucSub
mam: true
persistent: true
public: false
public_list: false
mod_muc_admin: {}
mod_offline:
access_max_user_messages: max_user_offline_messages
mod_ping: {}
mod_privacy: {}
mod_private: {}
mod_proxy65:
access: local
max_connections: 5
mod_pubsub:
access_createnode: pubsub_createnode
plugins:
- flat
- pep
force_node_config:
## Avoid buggy clients to make their bookmarks public
storage:bookmarks:
access_model: whitelist
mod_push: {}
mod_push_keepalive: {}
mod_register:
## Only accept registration requests from the "trusted"
## network (see access_rules section above).
## Think twice before enabling registration from any
## address. See the Jabber SPAM Manifesto for details:
## https://github.com/ge0rg/jabber-spam-fighting-manifesto
ip_access: trusted_network
mod_roster:
versioning: true
mod_s2s_dialback: {}
mod_shared_roster: {}
mod_stream_mgmt:
resend_on_timeout: if_offline
mod_vcard: {}
mod_vcard_xupdate: {}
mod_version:
show_os: false
### Local Variables:
### mode: yaml
### End:
### vim: set filetype=yaml tabstop=8
I apologize for the long message, but it provides the context.
Currently ejabberd does not support XEP-0424 so this won't work.

Mulesoft Insertion into Mongo DB database

I am using a Mongo DB connector to insert data into Mongo Instance located in mLab.
I am sure I am using the correct credentials since these credentials are working when I am using them through a Java code.
But here using the Mongo DB connector constantly throws me an error as can be seen below.
org.mule.api.ConnectionException: Couldn't connect with the given
credentials org.mule.api.ConnectionException: Couldn't connect with
the given credentials at
org.mule.module.mongo.MongoCloudConnector.getDatabase(MongoCloudConnector.java:1304)
at
org.mule.module.mongo.MongoCloudConnector.connect(MongoCloudConnector.java:1173)
at
org.mule.module.mongo.connectivity.MongoCloudConnectorConnectionFactory.makeObject(MongoCloudConnectorConnectionFactory.java:56)
at
org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1220)
at
org.mule.module.mongo.connectivity.MongoCloudConnectorConnectionManager.acquireConnection(MongoCloudConnectorConnectionManager.java:361)
at
org.mule.module.mongo.connectivity.MongoCloudConnectorConnectionManager.test(MongoCloudConnectorConnectionManager.java:444)
at
org.mule.tooling.metadata.api.utils.ConnectionTester.internalTestConnection(ConnectionTester.java:88)
at
org.mule.tooling.metadata.api.utils.ConnectionTester.testConnectionFor(ConnectionTester.java:113)
at
Is there something that I am missing here?
Below is the XML :
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:metadata="http://www.mulesoft.org/schema/mule/metadata" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:mongo="http://www.mulesoft.org/schema/mule/mongo" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/current/mule-mongo.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<http:request-config name="HTTP_Request_Configuration" host="developers.zomato.com" port="80" doc:name="HTTP Request Configuration"/>
<http:request-config name="HTTP_Request_Configuration1" host="api.mlab.com" port="80" doc:name="HTTP Request Configuration"/>
<mongo:config name="Mongo_DB" password="XXXXX" database="restaurant_data" host="ds241039.mlab.com" port="41039" doc:name="Mongo DB" username="XxXx"/>
<flow name="rest-webservice-applicationFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/rest" allowedMethods="GET" doc:name="HTTP"/>
<http:request config-ref="HTTP_Request_Configuration" path="api/v2.1/search" method="GET" doc:name="HTTP">
<http:request-builder>
<http:query-param paramName="entity_id" value="1"/>
<http:query-param paramName="entity_type" value="city"/>
<http:header headerName="user-key" value="XXXXXXXXX"/>
</http:request-builder>
</http:request>
<dw:transform-message doc:name="Transform Message" metadata:id="13f7b603-ac1e-45b4-9950-32c39a20ee36">
<dw:input-payload mimeType="application/json"/>
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
{
results_found: payload.results_found,
results_start: payload.results_start,
results_shown: payload.results_shown,
restaurants: payload.restaurants map ((restaurant , indexOfRestaurant) -> {
restaurant: {
R: restaurant.restaurant.R,
id: restaurant.restaurant.id,
name: restaurant.restaurant.name,
url: restaurant.restaurant.url,
location: restaurant.restaurant.location,
switch_to_order_menu: restaurant.restaurant.switch_to_order_menu,
cuisines: restaurant.restaurant.cuisines,
average_cost_for_two: restaurant.restaurant.average_cost_for_two,
price_range: restaurant.restaurant.price_range,
currency: restaurant.restaurant.currency,
offers: restaurant.restaurant.offers map ((offer , indexOfOffer) -> offer),
thumb: restaurant.restaurant.thumb,
user_rating: restaurant.restaurant.user_rating,
photos_url: restaurant.restaurant.photos_url,
menu_url: restaurant.restaurant.menu_url,
featured_image: restaurant.restaurant.featured_image,
has_online_delivery: restaurant.restaurant.has_online_delivery,
is_delivering_now: restaurant.restaurant.is_delivering_now,
deeplink: restaurant.restaurant.deeplink,
has_table_booking: restaurant.restaurant.has_table_booking,
events_url: restaurant.restaurant.events_url
}
})
}]]></dw:set-payload>
</dw:transform-message>
<mongo:json-to-dbobject doc:name="Mongo DB"/>
<mongo:insert-object config-ref="Mongo_DB" doc:name="Mongo DB" collection="restaurant"/>
</flow>
</mule>
The MongoDB connector uses the deprecated MONGODB-CR authentication mechanism, MLab is expecting the SCRAM-SHA-1 mechanism.
The SCRAM-SHA-1 mechanism is available in the enterprise version of Mulesoft ESB.
The connection URI configuration is available on version 4.2.0 and above. This is how you configure it:
Add the connector to pom.xml:
<dependency>
<groupId>org.mule.connectors</groupId>
<artifactId>mule-mongo-connector</artifactId>
<version>4.2.0</version>
</dependency>
Configure a connection in your flow:
<mongo:config-connection-string name="MongoDB_Config"
connectionString="mongodb://jdoe:myPass#localhost:27017?authMechanism=SCRAM-SHA-1"/>

CamelCase resgitraiton of eureka app using REST API

I'm using eureka server,Config server and zuul server,and registering a rest service using Eureka REST API provided at
Eureka REST Operations
eureka url to register : http://localhost:8761/eureka/apps/DemoClient
with post body as below :
{
"instance": {
"instanceId":"localhost:DemoClient58181",
"hostName": "localhost",
"app": "DemoClient",
"ipAddr": "localhost",
"vipAddress": "DemoClient",
"secureVipAddress": "DemoClient",
"status": "UP",
"port": {"$": "58181", "#enabled": "true"},
"healthCheckUrl": "http://localhost:58181/healthcheck",
"statusPageUrl": "http://localhost:58181/status",
"homePageUrl": "http://localhost:58181",
"dataCenterInfo": {
"#class": "com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo",
"name": "MyOwn"
}
}
}
i can see the app registered as below
<application>
<name>DEMOCLIENT</name>
<instance>
<instanceId>localhost:58181</instanceId>
<hostName>localhost</hostName>
<app>DEMOCLIENT</app>
<ipAddr>localhost</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">58181</port>
<securePort enabled="false">7002</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>30</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1523540991583</registrationTimestamp>
<lastRenewalTimestamp>1523540991583</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1523538580531</serviceUpTimestamp>
</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://localhost:58181</homePageUrl>
<statusPageUrl>http://localhost:58181/status</statusPageUrl>
<healthCheckUrl>http://localhost:58181/healthcheck</healthCheckUrl>
<vipAddress>DemoClient</vipAddress>
<secureVipAddress>DemoClient</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1523540991583</lastUpdatedTimestamp>
<lastDirtyTimestamp>1523540991075</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
when request with url http://localhost:58080/democlient/sayhello is accessed
but http://localhost:58080/DemoClient/sayhello is not accessed
when i add route configuration in zuul as
zuul:
ignoredServices: '*'
routes:
DemoClient:
path: /DemoClient/**
serviceId: DEMOCLIENT
then the CameCase route works.
Is there any way, how i can access route registering with CamelCase via REST api and not specifying route configuration in zuul.

How to configure outbound-socket-binding for SMTP mail in wildfly swarm for using yaml?

I am porting an application from Wildfly 10.0.1.0 to Wildly Swarm 2017.7.0.
Everything went rather smoothly except for the SMTP e-mail configuration using YAML:
I tried some alternatives, but here is the latest one based on what I think the yaml would be from standalone.xml mapping - project-defaults.yml
swarm:
socket-binding-groups:
mail-socket:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
mail:
mail-sessions:
smtpSession:
jndi-name: java:/smtpSession
smtp-server:
username: username_here
password: password_here
tls: true
outbound-socket-binding-ref: mail-smtp
However I still get error:
2017-08-05 11:17:36,100 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "mail"),
("mail-session" => "smtpSession")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.outbound-socket-binding.mail-smtp"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.mail-session.smtpSession is missing [jboss.outbound-socket-binding.mail-smtp]"]
}
2017-08-05 11:17:36,155 INFO [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0184: New missing/unsatisfied dependencies:
service jboss.outbound-socket-binding.mail-smtp (missing) dependents: [service jboss.mail-session.smtpSession]
------------------ Edited August 7th, 2017 -------------------
As advised by Ladicek I tried this:
swarm:
socket-binding-groups:
standard-sockets:
mail-socket:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
and
swarm:
socket-binding-groups:
standard-sockets:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
and
swarm:
socket-binding-groups:
standard-socket:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
However neither is working, still have the same error.
Could anyone please help on this?
---------------------- SOLVED ----------------------------
Need to upgrade to 2017.8.1 and use the below configuration
network:
socket-binding-groups:
standard-sockets:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
Thank you.
From the top of my head, I believe there's one level of the YAML structure you're missing: you need to select the socket binding group to which you add the socket binding. That's an artifact of WildFly's managed domain, which is a concept that doesn't apply to Swarm, yet you sometimes run into it. There's only one socket binding group in standalone WildFly and hence in Swarm: standard-sockets.
So the YAML will look like:
swarm:
socket-binding-groups:
standard-sockets:
mail-socket:
...
Also for any kind of questions about the Swarm YAML structure, consult https://reference.wildfly-swarm.io
Finally solved:
Need to upgrade to 2017.8.1 and use the below configuration
network:
socket-binding-groups:
standard-sockets:
outbound-socket-bindings:
mail-smtp:
remote-host: smtp.someprovider.com
remote-port: 587
Thank you.
This worked for me.
yml File:
swarm:
mail:
mail-sessions:
mail-socket:
jndi-name: java:/mail/NGSoftMail
smtp-server:
username: sigafco#xxxmail.com.co
password: *****
outbound-socket-binding-ref: mail-smtp
debug: true
from: sigafco#xxxmail.com.co
network:
socket-binding-groups:
standard-sockets:
outbound-socket-bindings:
mail-smtp:
remote-host: xxxmail.com.co
remote-port: 25
java File:
#ApplicationScoped
#Path("mailsender")
public class MailSender {
#Resource(mappedName = "java:/mail/NGSoftMail")
private Session session;
#GET
#Path("mail")
public String sendGet() throws Exception {
Message message = new MimeMessage(session);
message.setFrom();
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("david.vasquez#xxx.com.co", false));
message.setSubject("asunto!!!");
message.setSentDate(new Date());
message.setContent("contenido!!!", "text/html; charset=UTF-8");
Transport.send(message);
return String.format("{\"your_mail\": \"%s\"}", "OK");
}
}
pom file:
<dependency>
<groupId>org.wildfly.swarm</groupId>
<artifactId>mail</artifactId>
</dependency>

Spring cloude: Zuul & consul

I'm trying to create a Spring cloud microservice application using Zuul and Consul.
I have 2 components in my project:
api-gateway microservice using Zuul
Hello world microservice (a simple hello world Rest Webservice)
Here is the code of The api-gateway:
#SpringBootApplication
#EnableZuulProxy
#EnableDiscoveryClient
public class ZuulApplication {
public static void main(String[] args) {
SpringApplication.run(ZuulApplication.class, args);
}
}
The pom.xml
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Brixton.M3</version>
</parent>
<properties>
<java.version>1.8</java.version>
<spring.cloud.consul.version>1.0.0.BUILD-SNAPSHOT</spring.cloud.consul.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</dependency>
<dependency>
<!-- Setup Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<!-- Setup Spring MVC & REST, use Embedded Tomcat -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<!-- Spring Cloud starter -->
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zuul</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-consul-all</artifactId>
<version>${spring.cloud.consul.version}</version>
</dependency>
</dependencies>
application.yml
zuul:
routes:
hello1:
path: /hello1/**
serviceId: microservice-example
logging:
level:
org.springframework: INFO
com.netflix: DEBUG
bootstrap.yml
spring:
application:
name: edge-server
cloud:
consul:
config:
enabled: true
host: localhost
port: 8500
Here is the code of hello microservice:
#SpringBootApplication
#EnableConfigServer
#EnableDiscoveryClient
#RestController
public class Application {
#RequestMapping(value="/hello1",method = RequestMethod.GET)
public String hello() {
System.out.print("hello1");
return "Hello1";
}
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).web(true).run(args);
}
}
bootstrap.yml:
spring:
application:
name: microservice-example
profiles:
active: native
cloud:
consul:
config:
enabled: true
host: localhost
port: 8500
But, when I test my service the browser shows this message:
Here is the stacktrace of edge-server application:
2015-11-25 16:49:31.780 DEBUG 9876 --- [nio-8080-exec-7] c.n.zuul.http.HttpServletRequestWrapper : Path = null
2015-11-25 16:49:31.781 DEBUG 9876 --- [nio-8080-exec-7] c.n.zuul.http.HttpServletRequestWrapper : Transfer-Encoding = null
2015-11-25 16:49:31.781 DEBUG 9876 --- [nio-8080-exec-7] c.n.zuul.http.HttpServletRequestWrapper : Content-Encoding = null
2015-11-25 16:49:31.781 DEBUG 9876 --- [nio-8080-exec-7] c.n.zuul.http.HttpServletRequestWrapper : Content-Length header = -1
2015-11-25 16:49:31.782 DEBUG 9876 --- [nio-8080-exec-7] c.n.loadbalancer.ZoneAwareLoadBalancer : Zone aware logic disabled or there is only one zone
2015-11-25 16:49:31.782 DEBUG 9876 --- [nio-8080-exec-7] c.n.loadbalancer.LoadBalancerContext : microservice-example using LB returned Server: FR09248851D:1234 for request
2015-11-25 16:49:31.783 DEBUG 9876 --- [nio-8080-exec-7] com.netflix.niws.client.http.RestClient : RestClient sending new Request(GET: ) http://FR09248851D:1234
2015-11-25 16:49:31.783 DEBUG 9876 --- [nio-8080-exec-7] c.n.http4.MonitoredConnectionManager : Get connection: {}->http://FR09248851D:1234, timeout = 2000
2015-11-25 16:49:31.783 DEBUG 9876 --- [nio-8080-exec-7] com.netflix.http4.NamedConnectionPool : [{}->http://FR09248851D:1234] total kept alive: 1, total issued: 0, total allocated: 1 out of 200
2015-11-25 16:49:31.783 DEBUG 9876 --- [nio-8080-exec-7] com.netflix.http4.NamedConnectionPool : Getting free connection [{}->http://FR09248851D:1234][null]
2015-11-25 16:49:31.783 DEBUG 9876 --- [nio-8080-exec-7] com.netflix.http4.NFHttpClient : Stale connection check
2015-11-25 16:49:31.784 DEBUG 9876 --- [nio-8080-exec-7] com.netflix.http4.NFHttpClient : Attempt 1 to execute request
2015-11-25 16:49:31.791 DEBUG 9876 --- [nio-8080-exec-7] com.netflix.http4.NFHttpClient : Connection can be kept alive indefinitely
2015-11-25 16:49:31.796 DEBUG 9876 --- [nio-8080-exec-7] c.n.http4.MonitoredConnectionManager : Released connection is reusable.
2015-11-25 16:49:31.796 DEBUG 9876 --- [nio-8080-exec-7] com.netflix.http4.NamedConnectionPool : Releasing connection [{}->http://FR09248851D:1234][null]
2015-11-25 16:49:31.796 DEBUG 9876 --- [nio-8080-exec-7] com.netflix.http4.NamedConnectionPool : Pooling connection [{}->http://FR09248851D:1234][null]; keep alive indefinitely
2015-11-25 16:49:31.796 DEBUG 9876 --- [nio-8080-exec-7] com.netflix.http4.NamedConnectionPool : Notifying no-one, there are no waiting threads
2015-11-25 16:49:35.721 DEBUG 9876 --- [service-example] c.netflix.loadbalancer.BaseLoadBalancer : LoadBalancer: PingTask executing [1] servers configured
2015-11-25 16:49:35.885 DEBUG 9876 --- [clean up thread] com.netflix.http4.ConnectionPoolCleaner : Connection pool clean up started for client microservice-example
2015-11-25 16:49:35.885 DEBUG 9876 --- [clean up thread] c.n.http4.MonitoredConnectionManager : Closing expired connections