I'm using Service Fabric v6.1.472. We're trying to switch to using Service Fabric Remoting (https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-communication-remoting), specifically to use the v2 listeners.
The problem I'm running in to is that the documentation only says how to do it using a single listener via the extension method:
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return this.CreateServiceRemotingInstanceListeners();
}
This assumes that
The service class implements the remoting interface
There is only one remoting v2 endpoint in the host (I need multiple endpoints).
When digging into the decompiled code, it looks like this extension method uses a hard-coded endpoint name, which would make it impossible to use this for multiple remoting endpoints. Further digging revealed that many of the methods used by the extension method are marked internal.
Short of creating my own library, has anyone else found a workaround to this bit of bad design?
Edit
Microsoft updated their documentation. Under the header "Using explicit V2 classes to use the V2 stack," it is clear how to create listeners without the extension method.
Related
I use springcloud to build the system, including many microservices。 For some interface calls, I use resttemplate annotated by #LoadBalance to implement load balancing, and use eureka as a registry center. However, when I call interfaces between different micro services, resttemplate sometimes will connect to wrong service. For example, I have service A, B, C, when service A call a service B's interface, resttemplate annotated by #LoadBalance will find the actual ip&port from eureka by service name first, and then build the actual url and send the request to target server, but sometimes, it will find the service C's ip&port when I call service B's interface, which cause a fail invoking. This case occurs infrequently but nerver disappear, I have been troubled for a long time, could anyone give me some suggestions? Thanks.
I learned why yesterday: it is a bug in spring cloud Dalston.RELEASE(https://github.com/spring-cloud/spring-cloud-commons/issues/224), and we happen to use this version. Spring cloud had fixed this bug in Dalston.SR2, and now it works fine
On my local machine in Visual Studio 2017, I created solution based on the .NET Core Stateless Service template, and added Microsoft.ServiceFabric.Services.Remoting.Runtime package to accept remote calls through RPC.
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return this.CreateServiceRemotingInstanceListeners();
}
Then I added interface ITestAccUp in a separate project:
public interface ITestAccUp : IService
{
Task NotifyAsync();
}
I added implementation of the interface to the stateless service, and created one more project, a .NET Core console client to run the service. The console is going to be run outside a cluster.
static void Main(string[] args)
{
ITestAccUp testAccUpClient = ServiceProxy.Create<ITestAccUp>(new Uri("fabric:/SFAccountUpTest/Stateless1"));
testAccUpClient.NotifyAsync().Wait();
}
However, when I run it I got the error "InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'IFabricTestManagementClient4'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B96AA7D4-ACC0-4814-89DC-561B0CBB6028}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).",
though Named Application fabric:/SFAccountUpTest/Stateless1 seems to be up and running.
I guess the problem is RPC calls are just made for calling services inside SF clusters, not outside. Is it possible to make an RPC call outside a cluster, or is it necessary to build some sort of web API to make a service call?
As long as you're on the same network, you can call Services and Actors by using SF Remoting from other applications. For example, see this demo project which does so for testing purposes.
Make sure you use the same DLL that holds the interface definition from both the client and the service project. (It works different from WCF, where a proxy could be generated independently from the service, by using wsdl.)
Maybe you're running into an issue, like this one, or this one.
I realize this question is kinda old, but the way I solved this problem was to make sure I was using the "V2" remoting stack (details here)
Basically you need to edit your ServiceManifest.xml to use this as an Endpoint:
<Resources>
<Endpoints>
<Endpoint Name="ServiceEndpointV2" />
</Endpoints>
</Resources>
And add the [assembly] attribute to your remoting interface (above namespace).
Example:
...
using Microsoft.ServiceFabric.Services.Remoting;
using Microsoft.ServiceFabric.Services.Remoting.FabricTransport;
[assembly: FabricTransportServiceRemotingProvider(RemotingListenerVersion = RemotingListenerVersion.V2, RemotingClientVersion = RemotingClientVersion.V2)]
namespace ClassLibrary1
{
public interface IMyService : IService
{
...
I'm am trying to connect to a Service Fabric application using the ServiceProxy class like so:
return ServiceProxy.Create<ISomeService>(
new Uri("fabric:/SomeService.App/ISomeService"),
new ServicePartitionKey(0));
When I do this from a .Net Framework application everything works fine.
However, when I try this from a .Net Core application I get the following error:
InnerException = {System.Fabric.FabricInvalidAddressException: NamedEndpoint 'V2Listener' not found in the address '{"Endpoints":{"":"..."}}' for partition '...')
I'm assuming this has something to do with V2 remoting, but I can't figure out what exactly it is in the .Net Core project that is defaulting it to use V2 instead of V1.
Is there a way I can force it to use V1 - I'm not in a position to upgrade the target service to V2 at the moment.
All applications involved are using Service Fabric version 6.1.480
Only relevant documentation I can find is Service Fabric Reliable Services Communication Remoting and it hasn't helped me find a solution.
You can only use SF Remoting V2 in .Net Core.
Remoting V1 is supported using Full Framework only. (I agree that the documentation should specify this.)
See this link
I just tried to do a attempted a seamless upgrade of a service in a test setup. The service is being accessed by a Feign client. And naively I was under the impression that with multiple instances available of the service, the client would retry another instance if it failed to connect to one.
That, however, did not happen. But I cannot find any mention of how Feign in Spring Cloud is supposed to be configured to do this? Although I have seen mentions of it supporting it (as opposed to using RestTemplate where you would use something like Spring Retry?)
If you are using ribbon you can set properties similar to the following (substituting "localapp" for your serviceid):
localapp.ribbon.MaxAutoRetries=5
localapp.ribbon.MaxAutoRetriesNextServer=5
localapp.ribbon.OkToRetryOnAllOperations=true
ps underneath Feign has a Retryer interface, which was made to support things like Ribbon.
https://github.com/Netflix/feign/blob/master/core/src/main/java/feign/Retryer.java
see if property works - OkToRetryOnAllOperations: true
You can refer application ->
https://github.com/spencergibb/spring-cloud-sandbox/blob/master/spring-cloud-sandbox-sample-frontend/src/main/resources/application.yml
Spencer was quick...was late by few minutes :-)
How to create process with 1 service task - rest which calls
http://www.webservicex.net/currencyconvertor.asmx/ConversionRate?FromCurrency=EUR&ToCurrency=USD
and sets this value as parameter which can be seen later, using jbpm console(kie workbench)? JBOSS docs are mostly for user tasks.
My recommended solution is to create a new WorkItemHandler implementation that calls the web service get the results and inject that as a process variable.
You can see a similar example that calls web services here: https://github.com/droolsjbpm/jbpm-playground/tree/master/customer-relationships-workitems
HTH
There is a REST service task that you can use, available out-of-the-box in the web-based designer (under service tasks, so implemented as a custom service task). The associated handler should also be registered automatically when using the jbpm-installer:
https://github.com/droolsjbpm/jbpm/blob/master/jbpm-installer/conf/META-INF/CustomWorkItemHandlers.conf#L4