Menu
  • HOME
  • TAGS

How could I add a delay in processing failed messages in ServiceStack Redis MQ

Tag: servicestack,mq,servicestack.redis,redismqserver

Is there an easy way to get Servicestack to wait x seconds before retrying a failed MQ item (using Redis MQ). At the moment it just tries 3 times consecutively with no delay.

Best How To :

When you register a MQ handler you can also register an error handler which gets called after publishing a failed message which you can use to add a custom delay, e.g:

mqServer.RegisterHandler<MyRequest>(
    ServiceController.ExecuteMessage,
    (msgHandler, msg, ex) => Thread.Sleep(1000));

ServiceStack not rendering Razor View, only seeing Snap Shot

twitter-bootstrap,razor,twitter-bootstrap-3,servicestack,servicestack-razor

Looks like this problem might be coming from an existing MVC Razor item template that is adding NuGet package Microsoft.AspNet.Razor.3.2.2 which is overriding the ServiceStack.Razor reference. One way to avoid this is to use the basic HTML item template when adding a new view and name it with the cshtml...

Servicestack Embedding Javascript Resources

razor,servicestack,mef

The section on Embedded Resources in Virtual File System wiki explains the Embedded Resources support in more detail where you just need to ensure the Assembly that contains your embedded resources is defined in either the Config.EmbeddedResourceSources Assembly list or Config.EmbeddedResourceBaseTypes types list, e.g: SetConfig(new HostConfig { EmbeddedResourceSources = {...

ServiceStack View 403 (Forbidden)

razor,servicestack,servicestack-razor

See the difference between Views vs Content Pages, i.e. the /Views folder is a special folder for view pages that are only executed with the result of a Service (i.e. similar to ASP.NET MVC Controllers + Views). Essentially Razor pages in /Views can't be called directly, where as razor pages...

IBM MQ Asynchronous fetch using .Net

.net,asynchronous,websphere-mq,mq

Your question and code don't match. Is the sender putting messages messages in groups? Because your code is looking for exactly 1 group of messages then it exits the loop. If you want to read all messages (no group) in a loop then you should do something like: MQMessage mqMsg;...

ServiceStack.OrmLite SqlServer new Merge method doesn't work for different names of references

c#,sql-server,servicestack,ormlite-servicestack

This should now be resolved with this commit which is available from v4.0.41+ that's now available on MyGet.

ServiceStack minimum configuration to get Redis Pub/Sub working between multiple Web sites/services

servicestack,servicestack.redis

The minimum code for a publisher is just: var redisManager = container.Resolve<IRedisClientsManager>(); using (var mqProducer = new RedisMessageProducer(redisManager)) { mqProducer.Publish(new Msg { ... }); } You could also use a MessageFactory: var msgFactory = new RedisMessageFactory(redisMangager); using (var mqClient = msgFactory.CreateMessageQueueClient()) { mqClient.Publish(new Msg { ... }); } ...

ServiceStack Authenticates both iOS Apps when one is logged in

rest,xamarin,servicestack,restful-authentication,servicestack-auth

The issue is because you're using the same Session Cookies with a shared ServiceClient instance which ends up referencing the same Authenticated Users Session. ServiceStack Sessions are only based on the session identifiers (ss-id/ss-pid) specified by the clients cookies, if you use the same cookies you will be referencing the...

ServiceStack Is IsDebuggingEnabled in View (HttpContext missing)

asp.net-mvc,servicestack

You can access the current HttpContext via the singleton: @System.Web.HttpContext.Current.IsDebuggingEnabled ...

ServiceStack AutoQuery ordering

order,servicestack

AutoQuery lets you specify multiple Order By's where you can sort in reverse order by prepending a - before the field name, e.g: ?orderBy=X,-Y ...

ServiceStack.Text deserialize string into single object null reference

c#,.net,json,servicestack

By Default ServiceStack only serializes public properties so you could refactor your DTO to include properties, e.g: public class CustomMaker { public int UserID { get; set; } public String error { get; set; } } Or if you wanted to serialize public fields you can specify this with: JsConfig.IncludePublicFields...

OrmLite: SQLiteExceptionSQL logic error or missing database near “)”: syntax error

c#,sqlite,servicestack,ormlite-servicestack

This issue is because you Foo doesn't have any columns to INSERT since Id is a autoincrementing primary key and Bar is a [Reference] property so no columns are saved so the INSERT SQL ends up looking like: INSERT INTO "Foo" () VALUES (); This would work if you Foo...

Run MQSC Command via SYSTEM.ADMIN.COMMAND.EVENT

ibm,websphere-mq,mq

Couple of problems here. First, you are using the wrong queue. The command server listens on SYSTEM.ADMIN.COMMAND.QUEUE. The queue to which you are sending messages, SYSTEM.ADMIN.COMMAND.EVENT is the queue to which the QMgr puts event messages after executing commands, provided of course that command events are enabled. The second problem,...

Run Linux/MQSC commands from mq client

linux,ibm,websphere-mq,mq

I add a remote Queue Manager to my WebSphere MQ client. I'm not at all sure what this means exactly. MQ Explorer keeps a list of queue manager definitions. MQ Client is just a library for making connections. If you meant you added a remote queue manager to MQ...

How to configure NLog (Servicestack) for Multiple files

c#,servicestack,nlog

You should be able to simply use ${threadid} (or if you name your threads, ${threadname}) in the filename layout. This will automatically separate log entries into one file for each thread. <target name="mynewlogfile" xsi:type="File" fileName="${basedir}/logs/mynewlogfile-thread-${threadid}.log" ... layout="${longdate}|${callsite}|mynewlogfile|${message}" /> ...

Ormlite int based enums coming as varchar(max)

servicestack,ormlite-servicestack

Add a [Flags] attribute to enums you want ServiceStack to treat as integers.

Convert SQL to ServiceStack.ORMLite Sql Server

c#,sql-server,tsql,servicestack,ormlite-servicestack

For custom SQL like this, you'd use OrmLite's Custom SQL API's, with something like: var results = db.Select<Poco>(@"select convert(date, t.TransactionDate) [Date], tm.TeamName, a.AccountName, count(distinct(t.RequisitionNumber)) Total from task.tblTransactions t inner join task.tblRequisitions r on r.RequisitionNumber = t.RequisitionNumber inner join task.tblAccounts a on a.AccountNumber = r.AccountNumber inner join Team tm on tm.DivisionId...

Run OS Commands with MQ Service object - AMQ8734- Command failed - Program could not be started

ibm,websphere-mq,mq

There's a combination of things wrong... Your SERVTYPE(SERVER) is for something which starts running and stays running (and hence whose health is monitored). SERVTYPE(COMMAND) is for something you run and ends. Only a SERVTYPE(SERVER) can be monitored for health but it ought to be long running. Your startcmd needs to...

ServiceStack Soap 1.2 HTTPS Client

c#,soap,https,servicestack,soap1.2

The problem with config file is that it isn't always straightforward and sometimes plain unpractical. On top of this ServiceStack promotes config-less coding model. I managed to achieve the required functionality with the following SSL-neutral client: public class SoapServiceClient : Soap12ServiceClient { public SoapServiceClient(string uri) : base(uri) { if (uri.StartsWithIgnoreCase("https://"))...

How do I enable HTTP Compression when using servicestack with IIS8

compression,servicestack

If you just want to add a header you can always add a GZip ContentEncoding Response Header with a Response Filter, e.g: GlobalRequestFilters.Add((req, res, dto) => res.AddHeader(HttpHeaders.ContentEncoding, CompressionTypes.GZip)); But ServiceStack only compresses cached responses itself i.e. when using ToOptimizedResult() API's or returning a responses in a CompressedResult, e.g: public object...

Updating Xamarin app with servicestack

xamarin,servicestack

The official API has never changed and only has ever been IosPclExportClient: IosPclExportClient.Configure(); The class is defined in the ServiceStack.Pcl.iOS.dll and should be added by NuGet when you add the ServiceStack.Text NuGet package. If it's not you can try removing and re-adding the NuGet package again, otherwise you can adding...

Service Stack set HttpCookie.Secure Flag / Attribute?

servicestack

You need to use SetConfig() when configuring ServiceStack, e.g: SetConfig(new HostConfig { OnlySendSessionCookiesSecurely = true, }); ...

ServiceStack MemoryCached Authentication Register User

c#,servicestack

You'll need to enable the Registration Services to expose Services that allows creating a User with Password, e.g: Plugins.Add(new AuthFeature(() => new CustomUserSession(), new IAuthProvider[] { new CredentialsAuthProvider(), ... }) { IncludeRegistrationService = true }); The IncludeRegistrationService=true option enables ServiceStack's built-in RegisterService which allows creating new users at /register. You...

ServiceStack Cannot Set Session with Redis

servicestack,servicestack.redis

It appears that I had installed an older version of Redis 2.4.6, and that service was still running. By uninstalling it, and installing Redis 2.8.19, the issue was resolved.

ServiceStack CredentialsAuthProvider is ignore rememberMe = false

servicestack

Both of ServiceStack ss-id and ss-pid Session Cookies are always created. The ?RememberMe=true parameter indicates that the Users Session should be stored under the permanent Id ss-pid instead of the default Temporary Session Id ss-id which is how Users Sessions can survive Browser restarts since the ss-pid permanent Cookie isn't...

Do the Request filters get run from BasicAppHost?

servicestack

No the Request and Response filters only fire for Integration Tests where the HTTP Request is executed through the HTTP Request Pipeline. If you need to test the full request pipeline you'd need to use a Self-Hosting Integration test. Calling a method on a Service just does that, i.e. it's...

How to use InsertOnly method in OrmLite?

servicestack,ormlite,ormlite-servicestack

You can find some examples in ApiSqlServerTests, e.g: db.InsertOnly(new Poco { FirstName = "Amy", Age = 27 }, q => q.Insert(p => new { p.FirstName, p.Age })); and async versions in ApiSqlServerTestsAsync, e.g: await db.InsertOnlyAsync(new Poco { FirstName = "Amy", Age = 27 }, q => q.Insert(p => new {...

Servicestack reverse routing exception

servicestack

Eventually the problem was with the capitalization of the HTTP method on the route declaration. It worked after I set the route as follows [Route("/user/UserName/{UserName}", "GET")] The service has been working, even when it was declared as "Get" but the "ToAbsoluteUri()" brought up the problem....

Swagger url for self hosted servicesteack service

.net,web-services,servicestack,swagger

This issue is now resolved in v4.0.41+ which is now available on MyGet. You can workaround previous versions by specifying the WebHostUrl for your Service, e.g: SetConfig(new HostConfig { WebHostUrl = "http://localhost:1337/api/" }); ...

can not create queue for QManager

ibm,websphere-mq,mq

Check your error logs (AMQERR01.LOG) for an explanation of why AMQ8135 was returned to the client - for security reasons clients aren't given more information and so you have to go to the logs to get the detail. I suspect the user you're running MQ Explorer and runmqsc as isn't...

Retrieve Custom exception message from service layer in ajax call

jquery,asp.net-mvc-5,asp.net-ajax,servicestack

I did following in order to fix my problem : I handled the WebServiceException in my controller method and in catch block I rethrow the exception by filling in required details (mainly my custom exception message from server). Controller method is decorated with "HandleExceptionAttribute" [HandleExceptionAttribute] public JsonResult SearchCustomer(string IndexNo) {...

How could I add a delay in processing failed messages in ServiceStack Redis MQ

servicestack,mq,servicestack.redis,redismqserver

When you register a MQ handler you can also register an error handler which gets called after publishing a failed message which you can use to add a custom delay, e.g: mqServer.RegisterHandler<MyRequest>( ServiceController.ExecuteMessage, (msgHandler, msg, ex) => Thread.Sleep(1000)); ...

ServiceStack selfhosting disable caching for memory

model-view-controller,servicestack

Every request does not get cached in memory, when you're self-hosting it's running the binary dlls and static files that are copied into your /bin folder. You can change Config.WebHostPhysicalPath to change ServiceStack to serve files from your solution folder instead, e.g: SetConfig(new HostConfig { #if DEBUG DebugMode = true,...

ServiceStack Self Hosting Redirect any 404 for SPA (Url Rewrite)

angularjs,servicestack

You can register a Fallback Route with a wildcard for this which will let you handle unknown server routes in your Service in order to return the default page so routing can be handled in the client app, e.g: [FallbackRoute("/{PathInfo*}")] public class FallbackForClientRoutes { public string PathInfo { get; set;...

Hide/remove columns from servicestack requestlogger page

servicestack

You can take a copy of the built-in InMemoryRollingRequestLogger and modify it to suit your needs and then register to use it with: Plugins.Add(new RequestLogsFeature { RequestLogger = new MyRequestLogger() }); ...

ServiceStack versioning - how to customize the request deserialization based on versioning

servicestack

The recommended approach for versioning is to take advantage for the natural forwards compatibility of message-based services and extend existing services defensively so it can support multiple client versions and avoid create multiple versions of the same service. If you still want to expose /api/v1 routes than I'd recommend doing...

Can I check for the existence of an HTTP only cookie with Javascript? [duplicate]

javascript,authentication,cookies,servicestack,single-page-application

No. HTTP cookies are not exposed to the JS in any way....

How to make ServiceStak service internal access only

.net,servicestack

The easiest way to restrict all Services is to use a GlobalRequestFilter, e.g: GlobalRequestFilters.Add((req, res, dto) => { if ((RequestAttributes.InternalNetworkAccess & req.RequestAttributes) == 0) { res.StatusCode = (int)HttpStatusCode.Forbidden; res.StatusDescription = "External Requests are Forbidden"; res.EndRequest(); } }); ...

LINQ query fails with nullable variable ormlite

linq,servicestack,ormlite-servicestack

This is nature of the Linq. In order to achieve what you need, you will need to use two where closes: dbConn.Where<Product>(p => p.IsActive.HasValue).Where(p=>p.Value==true); ...

How to handle JSV with a comma(,) containing value?

servicestack,servicestack-text

JSV uses CSV-style escaping where any string that requires escaping should be wrapped with double-quotes, e.g: Address:"#39 ,street ,Country" ...

How to prevent the logging of a failed request to favorite.ico with ServiceStack

servicestack

The Logging is in the NotFoundHttpHandler itself so to avoid logging you'd return a custom HttpHandler that doesn't log, e.g: appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) => { if (pathInfo.StartsWith("/favicon")) return new CustomActionHandler((req,res) => { res.StatusCode = 404; res.StatusDescription = "Favicon not found"; res.EndRequest(); }); return null; }); ...

ServiceStack V4 Basic Auth with wrong credentials + CORS

c#,.net,servicestack,cors

I was able to workaround on this issue using following configuration in AppHost: UncaughtExceptionHandlers.Add((req, res, name, exception) => { //this is needed for inclusion of CORS headers in http error responses //(for example when invalid user credentials passed) res.ApplyGlobalResponseHeaders(); }); ...

JsonServiceClient ResponseFilter doesn't trigger

c#,servicestack

The example code you have provided, in isolation, looks correct apart from the client being disposed in the using statement. Once the client is created, an action can be registered on the ResponseFilter as you have shown above. I've created an example project on GitHub in empty ServiceStack ASP.NET solution...

Soap Address Location : ServiceStack SOAP 1.2

soap,wsdl,servicestack

You can modify the dynamically generated WSDL in ServiceStack by overriding AppHost.GenerateWsdl(), e.g: public override string GenerateWsdl(WsdlTemplateBase wsdlTemplate) { var wsdl = base.GenerateWsdl(wsdlTemplate); return wsdl.Replace( "<soap:address location=\"http:", "<soap:address location=\"https:"); } Add ServiceStack Reference Also as an alternative to SOAP you can use Add ServiceStack Reference which like SOAP allows generation...

ServiceStack authentication with both [Authenticate] and [ValidateApiKey] attributes

authentication,servicestack,api-key

Attributes can only be combined to add functionality, i.e. they can't be used as a fallback or a switch. To get the desired behavior your [ValidateApiKey] attribute should perform the validation fallback as part of its implementation, e.g: public class ValidateApiKeyAttribute : RequestFilterAttribute { public override void Execute(IRequest req, IResponse...

Servicestack Authentication namespace using SOAP

.net,api,soap,servicestack

You set your custom ns at the wsdl level, but the type itself is still using its own ns which I assume is the default one "http://schemas.servicestack.net/types". Not sure how you could change those built-in ns, not even sure if that's possible, but you might create your own auth provider...

ServiceStack intercept requests before they are sent client side

servicestack

I found a solution for this. Instead of using LocalHttpWebRequestFilter, need to just use RequestFilter. The final solution looks like this: var client = new JsonServiceClient(); client.RequestFilter += delegate(HttpWebRequest request) { // ContentType still null at this point so we must hard code it // Set these fields before trying...

What happened to SafeConvertAll in ServiceStack?

servicestack

It's just a safe wrapper around ConvertAll to treat null collections as empty collections, it's been replaced with a much shorter Map() alias, e.g: public object Get(Images request) { return Directory.GetFiles(UploadsDir) .Map(x => x.SplitOnLast(Path.DirectorySeparatorChar).Last()); } You can also use .Safe() to return an empty collection for null collections letting you...

ServiceStack Redis latest list by date

c#,model-view-controller,redis,servicestack

You can do this by maintaining an index of ids in a sorted list, sorted by date. As an example well store a list of articles with different modified dates, e.g: var articles = new[] { new Article { Id = 1, Title = "Article 1", ModifiedDate = new DateTime(2015,...

JMS QueueConnectionFactory vs ConnectionFactory

java,jms,jndi,mq

javax.jms package API says: For historical reasons JMS offers four alternative sets of interfaces for sending and receiving messages: •JMS 1.0 defined two domain-specific APIs, one for point-to-point messaging (queues) and one for pub/sub (topics). Although these remain part of JMS for reasons of backwards compatibility they should be considered...