Axon Distributed Command Bus+getting 404 while Posting the command - axon

I am using axon distributed command bus autoconfiguration using spring cloud and eureka
I observed all the required beans are getting created./member-capabilities is also exchanging the command information with other services and it is I can see this mapping exists in request mappings as well. Now when the command is being sent from another service by internally making a post-call to /spring-command-bus-connector/command endpoint
I am getting 404.
I checked that SpringHttpCommandBusConnector's bean is loaded in application context
I tried adding a component scan as well
Also tried registering this mapping manually with dispatcher servlet still no luck

Related

Lost context in #Blocking gRPC Service with Quarkus behind a GlobalInterceptor

I found that Quarkus Server binds io.quarkus.grpc.runtime.supports.blocking.BlockingServerInterceptor for each gRPC service with the #Blocking annotation before it starts.
If some global interceptors (with #GlobalInterceptor) set the Context value will not work. The Context will still be empty in the actual rpc method handler.
Is it a normal phenomenon because Context should be placed after BlockingServerInterceptor's vert.x executeBlocking? There are some associated issues: https://github.com/quarkusio/quarkus/issues/14665, https://github.com/quarkusio/quarkus/issues/13959.
Finaly I replace the #GlobalInterceptor with #RegisterInterceptor(MyInterceptor.class) , everything is to be ok that seems to prove my point.
I don't particularly understand the technical details of it, and these are what I got from trying and Debug. I've been using Spring and Micronaut before.

How to create command by consuming message from kafka topic rather than through Rest API

I'm using Axon version (3.3) which seamlessly supports Kafka with annotation in the SpringBoot Main class using
#SpringBootApplication(exclude = KafkaAutoConfiguration.class)
In our use case, the command side microservice need to pick message from kafka topic rather than we expose it as Rest api. It will store the event in event store and then move it to another kafka topic for query side microservice to consume.
Since KafkaAutoCOnfiguration is disabled, I cannot use spring-kafka configuration to write a consumer. How can I consume a normal message in Axon?
I tried writing a normal Kafka spring Consumer but since Kafka Auto COnfiguration is disabled, initial trigger for the command is not picked up from the Kafka topic
I think I can help you out with this.
The Axon Kafka Extension is solely meant for Events.
Thus, it is not intended to dispatch Commands or Queries from one node to another.
This is very intentionally, as Event messages have different routing needs apposed to Command and Query messages.
Axon views Kafka a fine fit as an Event Bus and as such this is supported through the framework.
It is however not ideal for Command messages (should be routed to a single handler, always) or Query messages (can be routed to a single handler, several handlers or have a subscription model).
Thus, I you'd want to "abuse" Kafka for different types of messages in conjunction with Axon, you will have to write your own component/service for it.
I would however stick to the messaging paradigm and separate these concerns.
For far increasing simplicity when routing messages between Axon applications, I'd highly recommend trying out Axon Server.
Additionally, here you can hear/see Allard Buijze point out the different routing needs per message type (thus the reason why Axon's Kafka Extension only deals with Event messages).

Spring Cloud Contract Debugging

Im new to Spring Cloud contract. I have written the groovy contract but the wiremock tests are failing. All I see in the console is
org.junit.ComparisonFailure: expected:<[2]00> but was:<[4]00>
Can anyone please guide me how to enable more debugging ad also is there a way to print the request and response sent by wiremock?
I have set the logging.level.com.github.tomakehurst.wiremock=DEBUG in my spring boot app but no luck
If you use one of the latest version of sc-contract, WireMock should print exactly what wasn't matched. You can also read the documentation over here https://cloud.spring.io/spring-cloud-static/Finchley.RELEASE/single/spring-cloud.html#_how_can_i_debug_the_request_response_being_sent_by_the_generated_tests_client where we answer your questions in more depth. Let me copy that part for you
86.8 How can I debug the request/response being sent by the generated tests client? The generated tests all boil down to RestAssured in some
form or fashion which relies on Apache HttpClient. HttpClient has a
facility called wire logging which logs the entire request and
response to HttpClient. Spring Boot has a logging common application
property for doing this sort of thing, just add this to your
application properties
logging.level.org.apache.http.wire=DEBUG
86.8.1 How can I debug the mapping/request/response being sent by WireMock? Starting from version 1.2.0 we turn on WireMock logging to
info and the WireMock notifier to being verbose. Now you will exactly
know what request was received by WireMock server and which matching
response definition was picked.
To turn off this feature just bump WireMock logging to ERROR
logging.level.com.github.tomakehurst.wiremock=ERROR
86.8.2 How can I see what got registered in the HTTP server stub? You can use the mappingsOutputFolder property on #AutoConfigureStubRunner
or StubRunnerRule to dump all mappings per artifact id. Also the port
at which the given stub server was started will be attached.
86.8.3 Can I reference text from file? Yes! With version 1.2.0 we’ve added such a possibility. It’s enough to call file(…​) method in the
DSL and provide a path relative to where the contract lays. If you’re
using YAML just use the bodyFromFile property.

Access server.xml content during servlet startup

I have an existing servlet and want to write some instructions to my log file on how to construct the URL needed to access my service . The basic logging service in J2EE is just fine for my purposes. The items I need are:
the canonical host name (got it)
the port number(s) for http connectors found in the server.xml file
the intermediate path to my servlet (servlet installation folder),
e.g. http://host:port/intermediate path/additional path
Using these three pieces of information I should be able to leave a breadcrumb of sorts in the log that tells administrators exactly how to configure my client-side app to access to this particular servlet instance.
Getting this information from within my implementation of HttpServlet.service() seems simple but I want to display the data during startup. Any thought on how to get it from within my implementation of HttpServlet.init()?

ESB Toolkit - No response from web service when using Orchestration Extender

I have the following itinerary:
A one way receive location passes a message to an orchestration where an inner message is extracted (unable to do this in a map).
The returned message from the orchestration is then mapped and the
result of that map, mapped again. Using the Microsoft.Practices.ESB.Services.Transform service.
This is then passed to a web service, via the Microsoft.Practices.ESB.Services.Routing service, which fires fine but I am not receiving the expected response which I want to write to file. The message that does get written to the file is the message passed to the web service rather than the expected response. Testing the web service using a simpler itinerary i.e. one without orchestration extenders shows that the web service works as expected.
The OffRamp is from the GlobalBank.ESB example application.
How can I get the required response from the web service?
So finally managed to find a solution to this for which I have to give full credit to this guy
The problem is Microsoft.Practices.ESB.Services.Routing Service only provides one way operation, so even if you mark your resolver with two-way message exchange pattern it wont work.
If you check Microsoft.Practices.ESB application in BizTalk Admin console, it has one one way dynamic send port Microsoft.Practices.ESB.Agents_2.1.0.0_Microsoft.Practices.ESB.Agents.Delivery_DeliveryPort_31bf3856ad364e35 which is bound to orchestration Microsoft.Practices.ESB.Agents.Delivery. When you use Orchestration extender and use Microsoft.Practices.ESB.Services.Routing service, this port is used to send any call and because this is one way port, you do not get response.
You need to use a Two-way orchestration in callwebservice shape. A sample Two-way orchestration is in MultipleWebServices ESB Sample. If you deploy that orchestration and register it as itinerary service and use it in callwebservice shape, it will work.
and it more or less did :) Deploy the orchestration and register it to the ESB as an itinerary service by adding an entry to the esb config between the itineraryServices node:
<itineraryService id="04BD6120-06E4-43D3-A56F-2FF061D59862" name="ESB.MultipleWebServices.Orchestrations.TwoWayRouting" type="ESB.MultipleWebServices.Orchestrations.TwoWayRouting, Biztalk.EsbGeneric.Orchestrations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=140bc5dcbb9afcea" scope="Orchestration" stage="None"/>
Create an id using guidgen, the type is made up of the name and assembly of the orchestraiton (comma seperated) in the Admin Console and will vary depending on the application that you have deployed to. scope and stage are as shown above.
Initially I had an error on the send port Biztalk.HoopleEsbGeneric.Orchestrations_1.0.0.0_ESB.MultipleWebServices.Orchestrations.TwoWayRouting_RoutingPort_140bc5dcbb9afcea but changing the send and receive pipelines to PassThruTransmit and PassThruReceive respectively solved this.

Resources